Jump to content

Command to eliminate spaces in names


---
 Share

Recommended Posts

I'm looking for a command to eliminate spaces in a name. For example: from "AA 12 B 6" converted into "AA12B6" by command.
Is there a solution in PCM that I can't find?
Link to comment
Share on other sites

Hi

I don't think there is an dedicated command for this.
but I suggest to loop thru your string and then put it back together.

>strElement< can cut out a part of your string and return it like:
strElement(i, ";", string) or more characters
strElement(i, ".pdf", string)

sInput = " AA 12 B 6 - 0 8 1 5 "
sOutput = ""
sTemp = ""
iTemp = 0

repeat 
	iTemp = iTemp +1
	sTemp = strElement(iTemp, " ",sInput)
	sOutput = text(sOutput, sTemp)
until (sTemp == "") and (iTemp > 1)
Link to comment
Share on other sites

Works great, thanks!
and with this code you can replace any character with another
(in this example spaces are replaced by underscores)
sInput = " AA 12 B 6 - 0 8 1 5 "
sOutput = ""
iTemp = 0

repeat
	iTemp = iTemp +1
	sChar = mid(sInput,iTemp,1)
	if sChar == " "
	sOutput = text(sOutput,"_" )
	else
	sOutput = text(sOutput,sChar )
	endif
until (iTemp > len(sInput))
Link to comment
Share on other sites

  • 2 weeks later...
little bit easier:
textVal="AA 12 B 6"
textTofind=" "
replaceWith = ""
textOutput=executeCode("'" + textVal + "' copyReplaceAll: '" + textTofind + "' with: '" + replaceWith + "'")
Link to comment
Share on other sites

  • 2 weeks later...
 Share

×
×
  • Create New...