how to find offset of =
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
how to find offset of =
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?
Last edited by renevanp on Sun Dec 12, 2010 2:19 pm, edited 1 time in total.
Re: how to find offset of =
You have to use the " & " character.renevanp wrote: put "Instellingen_MCMbestandenpath=T:\MCMbestanden" into $inhoudregel2
answer "offset = " offset("=",$inhoudregel2 )
Code: Select all
put "Instellingen_MCMbestandenpath=T:\MCMbestanden" into $inhoudregel2
answer "offset = " & offset("=",$inhoudregel2 )
Re: how to find offset of =
Hi Rene,
you forgot the ampersand (&) this works
regards
Bernd
you forgot the ampersand (&)
Code: Select all
put "Instellingen_MCMbestandenpath=T:\MCMbestanden" into $inhoudregel2
answer "offset = " & offset("=",$inhoudregel2 )
regards
Bernd
Re: how to find offset of =
Thanks Bernd that does indeed work with answer
But when you answered I was just editing my post, I still have a problem with the following line
case offset("=",$inhoudregel ) is greather than 1 which doesn't seem to work
But when you answered I was just editing my post, I still have a problem with the following line
case offset("=",$inhoudregel ) is greather than 1 which doesn't seem to work
Re: how to find offset of =
Rene,
Bangkok was first...
you can use case only inside a switch statement.
You could say this:
if the offset function returns 0 it did not find anything
regards
Bernd
Bangkok was first...

you can use case only inside a switch statement.
You could say this:
Code: Select all
on mouseUp
put "Instellingen_MCMbestandenpath=T:\MCMbestanden" into $inhoudregel2
put offset("=",$inhoudregel2 ) into tWhere
if tWhere > 0 then
answer "offset = " & tWhere
end if
end mouseUp
regards
Bernd
Re: how to find offset of =
Ok I figured it out myself
greather than 1 is not working because it is not good english
greater than 1 is not working
> 1 does work
thanks to all that replied
greather than 1 is not working because it is not good english
greater than 1 is not working
> 1 does work
thanks to all that replied