how to find offset of =
Posted: Sun Dec 12, 2010 1:51 pm
I want to determine if a variable contains the = sign
I'm ussing:
$inhoudregel contains: Instellingen_MCMbestandenpath=T:\MCMbestanden
repeat for each line $inhoudregel in $inhoud
switch
--testen of het een section regel is
case offset("[",$inhoudregel ) is 1
--sectieregel gewoon overnemen
put $inhoudregel & return after $newInhoud
break
case offset("#",$inhoudregel ) is 1
--sectieregel gewoon overnemen
put $inhoudregel & return after $newInhoud
break
case offset(";",$inhoudregel ) is 1
--sectieregel gewoon overnemen
put $inhoudregel & return after $newInhoud
break
case offset("=",$inhoudregel ) is greather than 1
--sleutels eventueel aanpassen
put offset("=",$inhoudregel ) into $Isteken
put char 1 to ($Isteken - 1) of $inhoudregel into $propkey
if exists(myCustomProps[$propkey]) then
--waarden aanpassen
put $propkey & "=" & myCustomProps[$propkey] & return after $newInhoud
else
--oude waarden weer terugschrijven
put $inhoudregel & return after $newInhoud
end if
break
default
--answer "offset = " offset("=",$inhoudregel )
--sleutels eventueel aanpassen
put offset("=",$inhoudregel ) into $Isteken
put char 1 to ($Isteken - 1) of $inhoudregel into $propkey
if myCustomkeys contains $propkey then
--waarden aanpassen
put $propkey & "=" & myCustomProps[$propkey] & return after $newInhoud
else
--oude waarden weer terugschrijven
end if
end switch
end repeat
This doesn't work: case offset("=",$inhoudregel ) is greather than 1
in the default part put offset("=",$inhoudregel ) into $Isteken does work
Do I need an escape character to escape the = sign?
I'm ussing:
$inhoudregel contains: Instellingen_MCMbestandenpath=T:\MCMbestanden
repeat for each line $inhoudregel in $inhoud
switch
--testen of het een section regel is
case offset("[",$inhoudregel ) is 1
--sectieregel gewoon overnemen
put $inhoudregel & return after $newInhoud
break
case offset("#",$inhoudregel ) is 1
--sectieregel gewoon overnemen
put $inhoudregel & return after $newInhoud
break
case offset(";",$inhoudregel ) is 1
--sectieregel gewoon overnemen
put $inhoudregel & return after $newInhoud
break
case offset("=",$inhoudregel ) is greather than 1
--sleutels eventueel aanpassen
put offset("=",$inhoudregel ) into $Isteken
put char 1 to ($Isteken - 1) of $inhoudregel into $propkey
if exists(myCustomProps[$propkey]) then
--waarden aanpassen
put $propkey & "=" & myCustomProps[$propkey] & return after $newInhoud
else
--oude waarden weer terugschrijven
put $inhoudregel & return after $newInhoud
end if
break
default
--answer "offset = " offset("=",$inhoudregel )
--sleutels eventueel aanpassen
put offset("=",$inhoudregel ) into $Isteken
put char 1 to ($Isteken - 1) of $inhoudregel into $propkey
if myCustomkeys contains $propkey then
--waarden aanpassen
put $propkey & "=" & myCustomProps[$propkey] & return after $newInhoud
else
--oude waarden weer terugschrijven
end if
end switch
end repeat
This doesn't work: case offset("=",$inhoudregel ) is greather than 1
in the default part put offset("=",$inhoudregel ) into $Isteken does work
Do I need an escape character to escape the = sign?