October 30, 2025, 11:22:30 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


istring

Started by oneplace2u, January 17, 2010, 03:21:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

oneplace2u

I know that a string can be converted to a number by using the val(string), can a istring be converted to a number?

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

oneplace2u

Quote from: Larry McCaughn on January 17, 2010, 05:02:19 PM
yes

Larry
I have tried this using the same program
but changing to istring and I get this error
"No Appropriate Conversion exists"

But it works fine with "string"

Is there a different way of doing this with "istring"?

num = VAL(bh[B + 3])
bh[B + 3] = STR$(num * 2)

LarryMc

January 17, 2010, 09:02:23 PM #3 Last Edit: January 17, 2010, 09:06:42 PM by Larry McCaughn
show me how you are declaring your istring.
what you posted above looks incorrect.

It doesn't appear that you read and understand what is in the following link that I previously pointed you to.

http://www.ionicwind.com/forums/index.php/topic,1650.msg15239.html#msg15239

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

oneplace2u

openconsole
def myfile,discfile:file
def file2$:string
def file3$:string
def file4$:string
def file5$:string
def file6$:string
def file7$:string
def file8$:string
def file9$:string
def file10$:string
def file11$:string
def file12$:string
def file13$:string
def bh[1400]:istring
def k:int
def a:int
def p:int
p = 1
a = 1
def B:int
def C:int
def n:int
c = 1
file2$ = "House_Accessories!Cutlery"
file3$ = "House_Accessories"
file4$ = "cutlery/standard/"
file5$ = "cutlery/large/mini-"
file6$ = ".jpg"
file7$ = "|"
file8$ = "||"
file9$ = "|||"
file10$ = "||||"
file11$ = "|||||"
file12$ = "%%OPTION%%"
file13$ = "blank-option.html"
file14$ = "this would be file13$ if there would be a option file, change file13$ to .html and add on the end of write file before file13$ RTRIM$(LTRIM$(bh[B + 2])) +"
k = 1415
openfile(myfile,"c:\\work\\product-cutlery.txt", "W")
openfile(discfile,"c:\\work\\cutlery.txt", "R")
do
read discfile,bh[a]

a = a + 1
until eof(discfile)
closefile discfile
B = 1
label round
if B = a then Goto exit
num = VAL(bh[B + 3])
bh[B + 3] = STR$(num * 2)
write myfile, RTRIM$(LTRIM$(STR$(k))) + RTRIM$(LTRIM$(file7$)) + RTRIM$(LTRIM$(file2$)) + RTRIM$(LTRIM$(file7$)) + RTRIM$(LTRIM$(bh[B + 3])) + RTRIM$(LTRIM$(file7$)) + RTRIM$(LTRIM$(bh[b])) + RTRIM$(LTRIM$(file7$)) + RTRIM$(LTRIM$(file4$)) + RTRIM$(LTRIM$(bh[b + 1])) + RTRIM$(LTRIM$(file6$)) + RTRIM$(LTRIM$(file7$)) + RTRIM$(LTRIM$(bh[B + 2])) + RTRIM$(LTRIM$(file8$)) + RTRIM$(LTRIM$(file5$)) + RTRIM$(LTRIM$(bh[B + 1])) + RTRIM$(LTRIM$(file6$)) + RTRIM$(LTRIM$(file11$)) + RTRIM$(LTRIM$(file12$)) +  RTRIM$(LTRIM$(file13$))
k = k + 1
B = B + 4
goto round
label exit
closefile myfile
print "Press Any Key To Close"
closeconsole
end

LarryMc


def bh[1400]:istring

That defines a single string that is 1400 characters long.

read discfile,bh[a]
That reads a single character and stores it somewhere in the istring which is actually an array of characters.

As stated in the link I referenced you to, to declare an array of istrings you have to define it:

def bh[1000,1400] where 1000(or whatever number you need) is the max length of one string and 1400(or however many you need) is the number of such strings.

so to read with your increment would be:

read discfile,bh[0,a] where 0 tells it to store it starting at the beginning of that particular element and the a tells it which element.

it follows that these
num = VAL(bh[B + 3])
bh[B + 3] = STR$(num * 2)

would become this:
num = VAL(bh[0,(B + 3)])
bh[0,(B + 3)] = STR$(num * 2)


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

oneplace2u

Thank you, that clears thing up a little pit, I hope I can remember it.