Announcement

Collapse
No announcement yet.

How best to insert space in text...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • wmgilligan
    replied
    Actually had tried "text" only - did not try the "". Just tested, and yup = you are right. That is the fix. Honestly, I don't recall ever actually doing that before (I feel like Jonathan!). Just re-read the docs, "If empty, output is suppressed unless explicitly output using the <MvEVAL> tag." I will remember that now.

    Leave a comment:


  • dcarver
    replied
    Sounds like you need to either set <MIVA STANDARDOUTPUTLEVEL = ""> for your entire file or on the function that is used in. Or you can even set it on the MvCAPTURE tag.

    Code:
    <MvCAPTURE VARIABLE = "l.data" STANDARDOUTPUTLEVEL = "">
    ...
    </MvCAPTURE>
    will give you what you want and still be readable.

    Leave a comment:


  • wmgilligan
    replied
    I ran into an interesting issue with this code that got it on the back burner till this morning. Bottom line... doing this with either MvCapture with MvFor or MvWhile caused a space to be placed between every character. Turns out - when using sublime text 3.2.2 Mac - there was a space inserted every time due to the lines used.

    This is the code I ended up with (changed from MvCapture while troubleshooting the space issue):
    Code:
    <MvAssign name="l.pos" value="1">
    <MvWhile expr="{ l.pos LE len(gettoken(l.mytext' ',2)) }"><MvASSIGN NAME = "l.char" VALUE = "{ substring_var(l.mytext, l.pos, 1) }"><MvASSIGN NAME = "l.asciivalue"  VALUE = "{ asciivalue( l.char ) }"><MvIF EXPR = "{ l.asciivalue GE 65 AND l.asciivalue LE 90 AND l.pos GT 1 }"><MvEVAL EXPR = "{ ' ' $ l.char}"><MvElse><MvEVAL EXPR = "{ l.char }"></MvIF><MvAssign name="l.asciivalue" value=""><MvAssign name="l.pos" value="{ l.pos + 1 }"></MvWhile>
    Note - all on one single continuous line. Likely an issue with my sublime settings - if anyone has ideas on fixing that - feel free to share.

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    IMO, its just easier cause you don't have to escape anything. I use it a lot when i need to capture formatted output, say XML or HTML.

    Leave a comment:


  • Jonathan-Driftwood
    replied
    Nice solution... Showing great age - I didn't even know there was an MvCAPTURE command; but can't figure out why its different from just testing/capturing the output result of a function. Still waiting for an MvMAKECOFFEE command.

    Leave a comment:


  • dcarver
    replied
    Code:
    <MvCAPTURE VARIABLE = "l.data">
        <MvFOR INDEX = "l.pos" COUNT = "{ len_var( l.info ) }">
            <MvASSIGN NAME = "l.char"        VALUE = "{ substring_var( l.info, l.pos, 1 ) }">
            <MvASSIGN NAME = "l.asciivalue"  VALUE = "{ asciivalue( l.char ) }">
    
            <MvIF EXPR = "{ l.asciivalue GE 65 AND l.asciivalue LE 90 AND l.pos GT 1 }">
                <MvEVAL EXPR = " ">
            </MvIF>
    
            <MvEVAL EXPR = "{ l.char }">
        </MvFOR>
    </MvCAPTURE>

    Leave a comment:


  • wmgilligan
    started a topic How best to insert space in text...

    How best to insert space in text...

    Here is what I have:
    <MvAssign name="l.info" value="LetsGetTogether">
    The output I want: Lets Get Together

    What is the best way to find the caps and insert a space before each one?
Working...
X