What is the best way of accomplishing this?
Thanks,
Posted 22 February 2002 - 16:54
What is the best way of accomplishing this?
Thanks,
Posted 22 February 2002 - 17:33
Posted 22 February 2002 - 17:34
For the find, nPosition = StrFind(szText, "_");
For the replace, szText[nPosition] = " ";
Just keep doing that until you run out in which case nPosition < 0.
Posted 22 February 2002 - 21:22
prototype RemoveUnderScores();
#include "ifx.h"
function OnBegin()
STRING szTestString, szMsg;
NUMBER nPosition, nFlag, nChars;
begin
szTestString = "This_Is_A_Test.";
nChars = StrLengthChars (szTestString);
MessageBox(szTestString, INFORMATION);
szMsg = "String '%s' is %d characters long.";
SprintfBox (INFORMATION, "Number of Characters", szMsg, szTestString, nChars);
nFlag = 0;
while nFlag = 0
nPosition = StrFind(szTestString, "_");
if nPosition = -1
then nFlag = 1;
else
szTestString[nPosition] = " ";
endif;
endwhile;
MessageBox(szTestString, INFORMATION);
end;
The MessageBox and SPrintFBox are in for diagnosing issues.
Thanks TacoBell.