Computer Science Canada string manipulation and arrays |
Author: | r0ssar00 [ Mon Feb 20, 2006 11:19 am ] | ||||
Post subject: | string manipulation and arrays | ||||
i have a function (already written)
any help would be appreciated |
Author: | Cervantes [ Mon Feb 20, 2006 7:20 pm ] |
Post subject: | |
Something is wrong. You say nameTag returns an integer, and yet the code you show us treats it as returning a string. I'll assume it's a typo, and it returns a string. nameTag (dataVar, 1) is returning a string of length more than 2. nameTag (dataVar, 3) is returning a string of length more than 3. I can't say more without knowing what dataVar is, or the nameTag function. |
Author: | r0ssar00 [ Tue Feb 21, 2006 11:31 am ] | ||
Post subject: | |||
it was a typo dataVar is the input to a the function which determines from dataVar if it should be labeled fileopen,fileclose,diropen,dirclose nameTag (dataVar, 1) where dataVar is "<f_test>test string 1</f_test> would return "f_test" nameTag (dataVar, 2) where dataVar is "<f_test>test string 1</f_test> would return "test string 1" nameTag (dataVar, 3) where dataVar is "<f_test>test string 1</f_test> would return "/f_test" this allows me to figure out what the first and last parts are going to be problem is, which i figured out with some puts, is that nameTag is returning "", not "f_trest" i guess that means you need the nameTag code so here it is
sorry all the code is indented, thats how it was indented in turing where raw:string is the input of " <f_test>data 1</f_test>" which may or may not have the whitespace at the beginning and where data:int tells the function what part of the string to return processName.returnFirst has two args: string to get first word from, and the character that is the desired seperator processName.returnMiddle has three args: string to get middle word from, the start seperator, and the end seperator (very useful in my opinion) processName.returnLast has similiar usage to returnFirst except that it goes from the last seperator to the end of the string this should be all you need thanks |
Author: | Cervantes [ Sat Feb 25, 2006 9:18 am ] | ||
Post subject: | Re: string manipulation and arrays | ||
r0ssar00 wrote:
What is the value of tmp(1)? What is the exact string (dataVar) you're passing to nameTag? |
Author: | r0ssar00 [ Mon Feb 27, 2006 2:42 pm ] |
Post subject: | |
im sorry, i have to say it, and no insult intended, but cervantes:are you thick? if you bothered to read _everything_ in both of my posts with code, you would find all the answers you are looking for. read from top to bottom, and then ask an intelligent question *please*, it will save us both time i already gave an example for dataVar, tmp is an array, look at the nameTag funtion for what it _should_ equal cervantes, read _all_ of the code i have posted, everything you need is right there |
Author: | Delos [ Mon Feb 27, 2006 5:09 pm ] | ||
Post subject: | |||
Ok now. Let's not get all aggravated over something as simply fixed as this...perhaps Cervantes misread your post (which, btw, I personally had a little bit of trouble following myself). Perhaps he was so stressed about which one of his 8K+ scholarships he should accept that he skipped a few words... The point being, he's a busy guy and does a lot around here. Be a little nicer, eh? Anyhow, I tried this...not sure if it's what you wanted, or if it works, but yeah, 'tis what I figured based upon what you posted.
I had to redo some of the, uh, missing bits of code. Probably similar to what you currently have. |
Author: | r0ssar00 [ Tue Mar 21, 2006 11:58 am ] |
Post subject: | |
it didnt work when put into the main program ill attach the code for the whole program. its supposed to turn an xml file into a filesystem accessible by turing programs. a really easy way to have configuration done in xml. it will later have links to real files on a drive. for now, im just reading it into memory. later there will be write support too. sorry for the lack of comments in my code. i have a whole lot at the beginning describing the program, but after that, theres close to nothing. p.s. another problem with the program is with the chars function, tmpData is null, there is no data in it, could you check that out too? thanks |
Author: | Delos [ Tue Mar 21, 2006 5:47 pm ] |
Post subject: | |
Are you sure you've posted the right files? Both are just filled with xml script. |
Author: | r0ssar00 [ Thu Mar 23, 2006 8:05 am ] | ||||
Post subject: | |||||
whoa, what the hell? i posted the right files, compsci's upload script screwed up, its the compsci homepage thats there instead. hmm. heres xmllibfs.t
yeah, i know, enough comments at the bigeinning, but i needed to have a plan, and i put it in this file neways, heres determine.tu
ha, beat that upload script! you cant fubar this! neways, thanks |
Author: | Andy [ Thu Mar 23, 2006 9:55 am ] |
Post subject: | |
done, done and done |
Author: | r0ssar00 [ Tue Apr 04, 2006 10:38 am ] |
Post subject: | |
thanks i still need some help with this though, if anybody would wish to join me in my quest to make a xml access library, feel free to pm me |
Author: | Cervantes [ Tue Apr 04, 2006 9:27 pm ] |
Post subject: | |
r0ssar00 wrote: im sorry, i have to say it, and no insult intended, but cervantes:are you thick? if you bothered to read _everything_ in both of my posts with code, you would find all the answers you are looking for. read from top to bottom, and then ask an intelligent question *please*, it will save us both time
i already gave an example for dataVar, tmp is an array, look at the nameTag funtion for what it _should_ equal cervantes, read _all_ of the code i have posted, everything you need is right there Hmm, I didn't notice this when it was first posted. It's long since passed, so I'll speak (sort of) generally. If you're asking others for help, it's a good idea to present all the information you think they'll need, and then some more. Those who help shouldn't have to read it scrupulously just to offer help. You're making it hard for people to help you. You talk as though I'm looking for answers in your code and that I should be asking the questions. Gah? Anyways, if I remember correctly, I was looking for the exact string you were passing that it failed on, not any odd string. (These could be the same.) I was also looking for whether your function actually correctly did what you said it did. Delos wrote: Perhaps he was so stressed about which one of his 8K+ scholarships he should accept that he skipped a few words... 10K scholarship from Queen's, today! And 3K bursary money for Eng / 1K bursary for Science! |