Skip to content
⌘ NSIS Forum Archive

WordFind "Skipping" Delimiters

3 posts

xbarns#

WordFind "Skipping" Delimiters

Hi all,

i am using

${WordFind} "$1" "," "E+1" $Firstname
${WordFind} "$1" "," "E+2" $Lastname
${WordFind} "$1" "," "E+4" $Workphone
${WordFind} "$1" "," "E+9" $Phone
${WordFind} "$1" "," "E+12" $Mobile

to parse a Thunderbird Adressbok CSV export, for example from the line below i want FirstName, Lastname, workphone and so on:

Alfonso,Affetuoso,AffetuosoAlfonso,,,,,+496101111111,,,,+49610111111,,,,,,,,,,,,,,,,,,,,,,,,pas-id-2892B1D448BC91DD,,

it seems though that multiple " , " are treated as one so of course i do get an error sometimes when going for the higher word counts.

Can i tell wordfind to treat every "," as a delimiter so no matter how many "empty" words there are it does not "combine" delimiters?

Thanks for your help.
Instructor#
Name "Test"
OutFile "Test.exe"
!include "WordFunc.nsh"
!insertmacro WordFind
Var Firstname
Var Lastname
Var Workphone
Var Phone
Var Mobile
Section
    StrCpy $1 "Alfonso,Affetuoso,AffetuosoAlfonso,,,,,+496101111111,,,,+49610111111,,,,,,,,,,,, ,,,,,,,,,,,,pas-id-2892B1D448BC91DD,,"
    ${WordFind} "$1" "," "+1{" $Firstname
    ${WordFind} "$Firstname" "," "-1}" $Firstname
    ${WordFind} "$1" "," "+2{" $Lastname
    ${WordFind} "$Lastname" "," "-1}" $Lastname
    ${WordFind} "$1" "," "+4{" $Workphone
    ${WordFind} "$Workphone" "," "-1}" $Workphone
    ${WordFind} "$1" "," "+9{" $Phone
    ${WordFind} "$Phone" "," "-1}" $Phone
    ${WordFind} "$1" "," "+12{" $Mobile
    ${WordFind} "$Mobile" "," "-1}" $Mobile
    MessageBox MB_OK "$Firstname|$Lastname|$Workphone|$Phone|$Mobile"
SectionEnd 
xbarns#
Thanks a lot, i even think i understand how it works (but please don't ask me to explain) 😁