I've tried to process a string using FORC but for whatever reason, it stops after encountering a space in the string.
Is there a way around this limitation? I've tried to use @SizeStr in combination with @CatStr but still having problems then to identify if quote is in the string.
STRING_MACRO macro s:req
FORC c, s
%ECHO c
ENDM
ENDM
STRING_MACRO "this is the string"
When compiling this, console displays
"
t
h
i
s
What I'd like to have is an if statement to determine what character is in the string like: if (c ne '"')
In the FORC-line, s must be enclosed in angle brackets:
position = 1
FORC c, <s>
IFIDN <c>,<!">
%echo Position: @CatStr(%position)
ENDIF
position = position + 1
ENDM
If you want to check whether the parameter s holds any quote, simply use @InStr() or INSTR:
position INSTR <s>,<!">
IF position
% echo Position: @CatStr(%position)
ENDIF
; or
IF @InStr(1,<s>,<!">) NE 0
% echo Position: @InStr(1,<s>,<!">)
ENDIF
EDIT: for more details, see MASM's Programmers Guide (http://remixshare.com/download/w3mwr), Chapter 9.
Thanks qWord! got it working.