carlosfocker
28th April 2006 18:29 UTC
Seperating String variables
I know there have been many posts on this subject but unless I'm blind they have not touch on the answer I am looking for.
My installer grabs user input from a list box on a page. This string needs to be split into two parts. One side is the name the other is the number. The problem is that the name part of this string can vary from 2 words to many words.
Right now I use a Function called Sort String 1 (from end) to pull the number out. I'm not to familiar with the whole concept of stacks and was wounder if I could get what is left over when i pull out the number
thanks
Brummelchen
28th April 2006 18:46 UTC
Please give an example.
so these strings are somehow seperated - think that
direction, it was thought before.
carlosfocker
28th April 2006 19:00 UTC
Example. This isnt the exact data that is being selected but is a similiar situation.
user selects: Lord of the Rings DDN 123456
number: DDN 123456
name: Lord of the Rings
User can also select: Harry Potter DDN 323456
Number: DDN 323456
Name: Harry Potter
As you can see there is a possibility that the name can be any length but the number value is always the same format.
Do you also want a code example?
Brummelchen
28th April 2006 19:09 UTC
i think StrStr will meet it in a modified way
http://nsis.sourceforge.net/StrStr
or wait for Instructors WordFunctions
http://forums.winamp.com/showthread....hreadid=203228
Instructor
28th April 2006 19:35 UTC
Name "Output"
OutFile "Output.exe"
!include "WordFunc.nsh"
!insertmacro WordFind
Section
StrCpy $R0 "Lord of the Rings DDN 123456"
${WordFind} "$R0" " " "-3{*" $R1
${WordFind} "$R0" " " "-2*}" $R2
MessageBox MB_OK "$$R1={$R1}$\n$$R2={$R2}"
SectionEnd
carlosfocker
1st May 2006 13:59 UTC
Instructor's code works well. I replaced $R1 and $R2 with the variables that I wanted the string to be seperated into.
ryuthomas
3rd January 2008 00:34 UTC
Yes!!!
This post is also helped me!
Thanks Instructor :)