Browsing this Thread:
1 Anonymous Users
|
Re: Decoding and encoding strings into numbers
|
||||
|---|---|---|---|---|
|
Just can't stay away
![]() |
OK, I will try it. Maybe I was lucky because my numbers was <127 so is no matter if that signed or not :)
Posted on: 2011/6/5 19:15
|
|||
|
||||
|
Re: Decoding and encoding strings into numbers
|
||||
|---|---|---|---|---|
|
Home away from home
![]()
|
(bumping this thread, so you don't miss it!)
Posted on: 2011/6/5 19:12
|
|||
|
||||
|
Re: Decoding and encoding strings into numbers
|
||||
|---|---|---|---|---|
|
Just can't stay away
![]() |
OK thanks. Here is my working code:
<pre> DEF mystring1[3]:STRING DEF mytable[3]: ARRAY OF INT StringF(mystring1,'\s','1Ab') mytable[0]:=mystring1[0]!!INT mytable[1]:=mystring1[1]!!INT mytable[2]:=mystring1[2]!!INT reverse: DEF mystring1[3]:STRING DEF mytable[3]: ARRAY OF INT mytable[0]:=49 mytable[1]:=65 mytable[2]:=98 FOR i:=0 TO 2 mystring1[i]:=mytable[i]!!CHAR ENDFOR </pre>
Posted on: 2011/6/5 13:25
|
|||
|
||||
|
Re: Decoding and encoding strings into numbers
|
||||
|---|---|---|---|---|
|
Home away from home
![]()
|
@mrdarek
If you want to get ASCII values for each character in the string, then you do not need to do anything! mystring[0] already has the value 65. They only appear as characters if you treat them as such (say Print('first letter="\c"\n', mystring[0])), or as a string if you treat it as such (say Print('string="\s"\n', mystring)). Hope that answers your question? Oh, and the length of the string is StrLen(mystring) .
Posted on: 2011/6/5 11:31
|
|||
|
||||
|
Decoding and encoding strings into numbers
|
||||
|---|---|---|---|---|
|
Just can't stay away
![]() |
I need encoding string into numbers and I don't know how to do.
For example I have: mystring[3]:STRING mytable[3]:ARRAY OF INT mystring:='ABC' After procedure mytable[0] should be 65 (because A=65) mytable[1] should be 66 and mytable[2] should be 67 I think that procedure should measure lenght of string and convert it using FOR LOOP... But how do it? And I need reverse procedure from this numeric table to 1 string.... Please help me???
Posted on: 2011/6/5 11:17
|
|||
|
||||
You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.






