ASP VBSCRIPT: for a declared string, inserting a line break every N characters

I'm using ASP VB. I want to insert a VbCr or a VbLf into a
declared string
every N characters. FWIW, I want to do this because of an
apparent
limitation in MSXML2, which I am using to "scrape" data from
webpages that I
control: I'm getting spurious exclamation points (!) where
line lengths are
too long. Manually inserting line breaks (which do not render
in HTML) seems
to solve the problem. Can someone tell me how to do this?
Put another way, I need to flesh out the following
pseudocode:
Dim myString, myCursorPosition, myIncrement
myString ="The quick brown fox jumped over the lazy dog."
myCurrentCursorPosition=0
myIncrement=5 ' I want a line break for every myIncrement
While [there are still remaining characters to walk through
in the string
' navigate cursor by myIncrement through myString
' insert a VbLf at myCurrentCursorPosition
myCurrentCursorPosition = myCurrentCursorPosition +
myIncrement
[loop]
Thanks for any help on the syntax here.
-KF

This is one possible solution specific to the problem I'm
having with MSXML.
Code is inefficient for explanatory clarity.
BodyAsHtmlString = replace(BodyAsHtmlString, "</a>",
("</a>"&vbcrlf))
BodyAsHtmlString = replace(BodyAsHtmlString, "</td>",
("</td>"&vbcrlf))
BodyAsHtmlString = replace(BodyAsHtmlString,
"</table>",
("</table>"&vbcrlf))
BodyAsHtmlString = replace(BodyAsHtmlString, "</tr>",
("</tr>"&vbcrlf))
BodyAsHtmlString = replace(BodyAsHtmlString, "</br>",
("</br>"&vbcrlf))
-KF
"Ken Fine" <[email protected]> wrote in message
news:e52ln5$i7$[email protected]..
> Thanks, this code works just fine. However, I'm
realizing that my logic is
> going to need to be a little more sophisticated. The
string that I am
> breaking includes HTML code. Inserting a VbCr can mess
up the code.
>
> I need a way so that the breaks won't break code. Any
ideas? If I could
> identify a char that only appeared in written text,
that's one hacky
> solution.
>
> Thanks again,
> -KF
>
> "Julian Roberts" <[email protected]> wrote in
message
> news:e52kjj$shd$[email protected]..
>> Try something like
>>
>> for i=0 to len(mySt) step 5
>> mySt=left(mySt,i) & vbcrlf &
right(mySt,len(mySt)-i)
>> next
>>
>> --
>> Jules
>>
http://www.charon.co.uk/charoncart
>> Charon Cart 3
>> Shopping Cart Extension for Dreamweaver MX/MX 2004
>>
>>
>>
>>
>
>

Similar Messages

  • User defined function for getting last string in the line

    Hi Experts,
    I am not java expert, can anyone give me user defined function for getting last string in the line.
    for example if the source field is "NEW ARBOUR SQUARE"  i want to pass to target field only last string that is "SQUARE"
    please help me out of this.
    Kind Regards.
    Praveen.

    You don't even need a UDF for this. In the graphical editor look for the standard functions and once you do a scroll over on 'text functions; you will find what you are looking for.
    Just a piece of advice, try keeping UDF's to minimum unless really required or it is complicated without it.
    regards

  • How to make a String with a line break?

    I want to insert a line break into a strhing...i am trying to do this using a Stringbuffer the following way:
    name = new StringBuffer().append("something").append('\n').append("else").toString();
    but it doesnt' seem to be working.
    any suggestions??
    Andrew

    that was just an example for testing purposes...if
    you read my posts.....
    i said:
    "i am passing a string to my corel template creator
    which is made in java and creates a template in Corel
    Draw.
    but when the string is being passed to the template
    creator i want it to be able to distinguish whether
    the string is supposed to be 2 lines or 1."
    i see zero correlation between that and HTML
    AndrewYour posts thus far strongly suggest that this text will utimately be HTML that will be rendered by a browser. I don't know what this Corel template is, but based on the other stuff you've said, I assumed it was some sort of HTML page template.
    If the text will ultimately be HTML that is rendered by a web browser, then the Corel stuff is irrelevant (unless the Corel template is a JSP or other dynamic page generator that lets you specify by some other means where to put line breaks, in which case you need to look at Croel's docs), and you need to insert <br> or <p> or use <pre> tags.
    If the Corel template is some sort of Java widget and you won't be rendering HTML with a web browser, then look at the docs for the Corel template, or contact Corel tech support.

  • Pressing Enter inserts new line break instead of "executing" command

    I have noticed a rather strange behavior on my new TPT2. This occurs ONLY when I am using the Windows 8 touch keyboard in the "Metro" environment.
    Whenever I press the Enter key on said keyboard (for example when sending an instant message on Skype), the keyboard inserts a new line in the text box instead of acting like a "normal" Enter key and execute the default command (send the message in this example).
    I have connected an external keyboard and this problem does not show up. Everything works as expected. I also brought up the regular on-screen keyboard (launched from the Ease of Access menu) and it works the way it should. The problem is only with the Metro touch keyboard.
    It seems that for some reason, the Metro touch keyboard interprets the Enter key pressing as "insert a line break".
    Does anyone know how to fix this? It is extremely annoying.

    Just checked that, you are right, Photoshop doesn't recognize Shift-Enter as a line break and treat it as a Return which is a problem with paragraph formatting. Obviously a bug.
    Good news workaround is that it recognizes the line break character if you paste it from another program like Microsoft Word. If you don't have a program that allows you to copy just that character and use paste instead of Shift-Return, you have to type your entire text in some other program and copy paste to Photoshop.

  • Calendar app. How do i insert a line break in the title of an appointment?

    How do i insert a line break in the title of an appointment?

    Jonny Marshall wrote:
    Hi, I've had this problem for a while now but just can't find the answer anywhere. I keep seeing that 'shift+return' or 'ctrl+return' will create a new line in a cell in numbers but it just doesn't! I can't seem to find a way of doing it. Please help!
    Difficult to guess what is wrong in your system or what you made wrongly.
    Here it work.
    Maybe a problem of corrupted preferences.
    Try to run Numbers from an other User Account.
    If it behaves flawlessly it will be time to try to disable the Preferences files:
    <startupVolume>:Users:<yourAccount>:Library:Preferences:com.apple.iWork.Numbers. plist
    <startupVolume>:Users:<yourAccount>:Library:Preferences:com.apple.iWork.Numbers. LSSharedFileList.plist
    (Also, not numbers related, but if you happen to know how I find out what version of OSX I'm using please let me know.)
    menu :  (Apple)
    menu item : About this mac
    Yvan KOENIG (VALLAURIS, France) jeudi 3 juin 2010 14:41:07

  • ICal 5.0 inserting a line break (Lion)

    With iCal v4 (Snow Leopard 10.6) one could insert a line break within an event by typing ALT+return.
    This functionality seems to have disappeared with iCal 5.
    Has anyone else noticed this? Is there a workaround?
    Many thanks!

    I'm considering 'busycal' although I feel like a shill paying $50 for it. Please do update this if you find a solution or try another app that works well for you.  Cheers, J

  • Inserting a Line Break - Bug

    I am running Dreamweaver CS4 on Windows. I have this weird situation that just started a few days ago.  Dreamweaver will no longer insert a simple line break by hitting shift and enter.  I have no reason why, instead it changes my title tag and ignores the command.  I am not sure if it is a bug or what.  Extremely annoying as that was a fast and simple way to format text on a page I was working on. Here is what the code looks like when I try this...
    Before...
    Variety of convenient and secure ways to access blocked SPAM<br />
    After...
      Variety of convenient and secure ways to access blocked SPAM
      <!-- MENU-LOCATION=NONE -->
    <br />
    It also changes my title tag on the page to...
    Line Break (Shift + Enter)
    The only thing I did was hold down the shift key and hit enter while my cursor was on a page in design view.  It used to simply insert a <br/> tag.  I have checked my preferences, check my keyboard, etc.  I can't find any reason why it suddenly started doing this.  Any ideas?

    There is a javascript function that will allow you to split the string into component parts. It puts these parts into an array. Here is some sample code that should give you the idea. Assuming TextField1 has the compete string and TextField2 is the field you want to enter the separted string into.
    var  
    strTemp =TextField1.rawValue;
    var  arrayTemp = strTemp.split(",");TextField2.rawValue
    = arrayTemp[0] + "\n";
    for  (i=1;i<arrayTemp.length;i++){   TextField2.rawValue
    += arrayTemp[i] +"\n";
    Paul

  • How to insert new line break in XSLT mapping

    Hi experts,
    I am doing file to mail scenario, i am sending the text file as an attachment using reciever mail adapter.
    I did everything, i can able to send the mail with text file attachment, but with in the file i got multiple rows, i need to put line break in XSLT mapping.
    I did use following statement but it is inserting small rectangle between the records, the records are not separating with new lines, all are in one line.
    <xsl:text>*#xA;</xsl:text>   
    note: in real coding replace * with &
    Can anyone suggest me how to insert new line in XSLT mapping.
    My XSLT mapping as look like:
    <?xml version='1.0'?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ns0="http://www.Coj.co.za/SapIsuToABSA/DirectDebitFile">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:variable name="break">&lt;br/&gt;</xsl:variable>
    <xsl:variable name="space"> </xsl:variable>
    <xsl:variable name="newline"><xsl:text></xsl:text></xsl:variable>
    <xsl:template match="/">
    <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
    <Subject>Please Check Attached Direct Debit File</Subject>
    <From>S@za</From>
    <To>P@za</To>
    <Content_Type>text/plain</Content_Type>
    <Content>
    <xsl:for-each select="MT_SapIsuToABSA_DirectDebitFile/DirectDebitRec/Body">
    <xsl:value-of select="Space1"/>
    <xsl:value-of select="Cust_AccNo"/>
    <xsl:value-of select="Reserve_1"/>
    <xsl:value-of select="Cust_Name"/>
    <xsl:value-of select="Cust_Name1"/>
    <xsl:value-of select="Cust_Bank_AccNo"/>
    <xsl:value-of select="Space2"/>
    <xsl:value-of select="Cust_Bank_BranchNo"/>
    <xsl:value-of select="Reserve_2"/>
    <xsl:value-of select="Space3"/>
    <xsl:value-of select="Cust_AccNo_1"/>
    <xsl:value-of select="Space4"/>
    <xsl:value-of select="Reserve_3"/>
    <xsl:value-of select="Deduction_Amnt"/>
    <xsl:value-of select="Space5"/>
    <xsl:value-of select="Reserve_4"/>
    <xsl:value-of select="Space6"/>
    <xsl:value-of select="Action_Date"/>
    <xsl:value-of select="Space7"/>
    <xsl:value-of select="Reserve_5"/>
    <xsl:text>*#xA;</xsl:text>   
    note: in real coding replace * with &
    </xsl:for-each>
    </Content>
      </ns1:Mail>
      </xsl:template>
      </xsl:stylesheet>
    Kind regards,
    Praveen

    Hi,
    I think <xsl:text>#xa;</xsl:text> should do the trick, but depending on which OS (ux or win), the "new line" chars sequence is different (win would require a CRLF like <xsl:text>#xd;*#xa;</xsl:text>)
    Chris
    -> &
    Edited by: Christophe PFERTZEL on Apr 14, 2010 2:16 PM

  • Inserting endline character after every 140 characters in an ascii file ?

    HI
    I have an input file in ASCII format , that has no end line characters in it(a single line file)
    And I want to insert, this end line character after every 140 characters..
    How it would be possible in ODI
    thanks

    If iam not wrong ,you are looking for this
    source file
    <140 character > < 140 characters >
    expected output
    <140 character >
    <140 character >
    Am i right ? Else can you please show an example .

  • NOOB Question: Insert a line break ( br or p )

    Hi,
    I try my first steps with webdynpro and find it a bit crazy.
    I now have created my first webapp and it rules but I have 2 questions:
    1. I have 10 elements, which are displayed all abreast, but I want at some elements a line break (<br> or <p>, I only have the solution with FormattedTextView where I can insert html)
    2. How I can add JavaScript-Functions and otherwise <html>-code? CSS-Tags and so on... Have I actually influence of the generated HTML?
    sorry for this noob-questions.
    Christian

    Hi
    In Web Dynpro You can not write HTML , Java Script or insert any CSS code.
    It is not possible.
    If you want a line break between UI elements, you should follow Layouts
    you have different types of Layouts
    1. Matrix Layout
    2. Grid Layout
    3. Row Layout
    4. Flow Layout
    You can control your layout only using the above options.
    Abhi

  • Need help for "From concatenate string insert to mysql table"

    Well, most of this problem is a question about SQL syntax. In the VALUES clause you put a comma delimited list of the values to go into the new record. You insert one record at a time. How are the columns defined? Have you done any study on basic SQL?
    Mike...

    i nid to insert values from concatenate string into mysql with using LabSQL, but the result come out from conatenate string is like " 2015-07-08 00:00:00 38.933235E-3" , a logged data of "Date Time Wind Speed(m/s). i nid to put these 3 values into 3 different column in mysql which is Date Time and Wind Speed. How can i pick Date to put inside Date's column, Time into Time's column and Wind Speed into Wind Speed's column in mysql ?
    What i do is
    INSERT INTO wind_speed_data (Date, Time, Wind_Speed) The space in Wind Speed can i put a _ in between Wind Speed? without _ and just put Wind Speed it shows errors.
    VALUES( i have no idea wat to key in at this part ) <--- nid help !
    The Mysql table. Date Time Wind Speed
    The result from concatenate string. Have to insert into mysql.
    My labview program.
    The error i facing.
     

  • How can I create a line break in pages for iPad?

    On the Mac you can hold the shift key while pressing the return key to creat a line break. Only pressing the return key will creat a new paragraph of course.
    On the iPad you only can creat paragraphs. Pressing the shif key does not change that.
    Does anybody know how to force a linebrek on the pages app for iPad?

    Tap and hold where you wish to insert the line break. Select Insert from the pop up menu, then Line break.
    this might be helpful for future reference: http://help.apple.com/pages/ipad/1.7/

  • Issue with splitting string into multiple lines

    Hi Experts,
    I have a long string s. I want to split this string into several lines each having 72 characters. For this I have done following programming:
         String s = "For the first time it includes a supplementary report attempting to determine if extreme weather
    events can be linked to human-induced climate change. The research team, including members
    of the UK Met Office, identified recent episodes of extreme weather then used a computer to
    estimate the likelihood of the episode happening in a world without increased CO2." ;
         s = s.replaceAll("[\r\n]+", " ");
         char[] sAr = s.toCharArray();
         AbstractList RecepitsList7 = new Bapitrtext.Bapitrtext_List();;
         int start = 0; // start with
         int i = 72 ;
    //     for (int i = 71; i < sAr.length; i++) {
    while (i < sAr.length) {
    //     {     if (sAr[i] == ' ')
                   Bapitrtext Recepits7 = new Bapitrtext();
                   Recepits7.setTextid("TEXT");
                   Recepits7.setTextline(s.substring(start, i).replaceAll("[\r\n]+", ""));
                   RecepitsList7.add(Recepits7);
                   start = i+1;
                   i += 72;
         input.setText(RecepitsList7);
    The output of program is as below:
    For the first time it includes a supplementary report attempting to dete
    mine if extreme weather events can be linked to human-induced climate
    hange. The research team, including members of the UK Met Office, iden
    ified recent episodes of extreme weather then used a computer to estim
    te the likelihood of the episode happening in a world without increased
    Here as we can see last characters are getting deleted by program. For example in first line
    determine 'r' is missing in extreme right.
    In 3rd line c is missing in extreme left (word change is needed. Program
    prints hange.
    Also in 3rd line extreme right 't' is missing
    Also in 4th line extreme right 'a' is missing
    Also the last line is not being printed. In last line "CO2." " should appear.
    There are two issues:
    1. Why last word of each sentence is not being printed?
    2. Why last sentence is not being printed?
    I am struggling since last 2 days. Please help. I made all changes like replacing 72 by 71 etc.
    By making such changes, I am able to print first line correctly. However under all cases
    last character of 2nd line onward is not getting displayed.
    Also last line is not getting displayed. I did every thing like using while instead of for loop etc.
    Kindly help.
    Regards,
    Gary
    Edited by: 945655 on Jul 10, 2012 11:39 PM

    String s = wdContext.currentContextElement().getExpense_Text();
         s = s.replaceAll("[\r\n]+", " ");
         char[] sAr = s.toCharArray();
         AbstractList RecepitsList7 = new Bapitrtext.Bapitrtext_List();;
         int start = 0; // start with
         int i = 72;
    while (i < sAr.length) {
                   Bapitrtext Recepits7 = new Bapitrtext();
                   Recepits7.setTextid("TEXT");
                   System.out.println(s.substring(start, i));
                   RecepitsList7.add(Recepits7);
                   start = i+1;
                   i += 72;
         input.setText(RecepitsList7);
    Edited by: 945655 on Jul 11, 2012 2:25 AM

  • Inserting line break within label

    Hey guys,
    i've run into a small problem with the coding. right now im
    creating image viewer within a horizontal list. at first, i had
    each object coded inside the horizontal list but then i decided to
    place everything in an xml file to make changes easier. since i've
    switched, i have not been able to figure out how to insert a line
    break for each label. this is what the code looked like when i was
    naming each object.
    <mx:HorizontalList id="PosterSelect" height="352"
    columnCount="3" columnWidth="200" width="580"
    rollOverColor="#ff3344" themeColor="#DC240B"
    itemClick="itemClicked(event)">
    <mx:dataProvider>
    <mx:Array>
    <mx:Object id="object1" label="March 12, 2008&
    #13;Chicago, IL" data="events"/>
    <mx:Object id="object2" label="March 12, 2008&
    #13;Chicago, IL" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event3}" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event4}" data="events"/>
    <mx:Object label="March 12, 2008& #13;Chicago, IL"
    icon="{event5}" data="events"/>
    </mx:Array>
    </mx:dataProvider>
    </mx:HorizontalList>
    within the label property, i used the & #13; character to
    insert a line break. now im using an item renderer to call the
    information from my xml file. the problem is... i cannot figure out
    how to insert a line break like i did previously. from what i
    understand... the text in the label field of the xml file is
    already parsed when it comes into flex. so using the & #13; or
    \n characters will not work. i also tried hitting enter to insert a
    new line in the xml file but that did not work either. does anyone
    know how i could work around this?? below is my current code and
    xml
    <eventinfo>
    <events>
    <label>March 12, 2008#13;Chicago, IL</label>
    <group>group name</group>
    <location>Detroit, MI</location>
    <icon>posters/event1.png</icon>
    <fullsize>posters/event1.png</fullsize>
    </events>
    <events>
    <label>March 12, 2008#13;Chicago, IL</label>
    <group>group name</group>
    <location>Detroit, MI</location>
    <icon>posters/event4.png</icon>
    <fullsize>posters/event1.png</fullsize>
    </events>
    </eventinfo>
    <mx:HorizontalList id="HorizontalCanvas" height="337"
    columnWidth="180" width="672"
    rollOverColor="#ff3344" themeColor="#DC240B"
    itemClick="callJavaScript()" x="10" y="33" borderStyle="solid"
    dataProvider="{eventinfo.events}" borderColor="#000000">
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox width="100%" height="350"
    horizontalAlign="center">
    <mx:Image source="{data.icon}"/>
    <mx:Label text="{data.label}"/>
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:HorizontalList>

    hey atta,
    sry, i was using the &#13; character but for some reason
    when i posted the character it turned into a space so i added the
    space inbetween the & and the #13;
    but yea i think it was the height... changed it to 40 and it
    worked.. i cant believe i didnt notice that lol... oh well... thx
    for the help!!!

  • Insert line break

    I am using v 7.0
    I have a 12 page outline and on page 7 I need to insert a new line of text.
    When using the Touchup text tool, insert and line break, a box is created around one line of text. Upon hitting the ENTER key instead of forcing a line break the line of text was pushed down and superimposed over a line of text below it. I am UNABLE to insert text in the newly created white space.
    1. How should I do this correctly?
    2. How may I correct this error?
    Thank you VERY much. frank

    You need to go back to the original document and make the change. Then create a new PDF. What you are trying to do is not a normal function of Acrobat. Editing can be done, but only minor editing. Moving lines is typically not one of the easy functions to do. You might be able to move the box below what you did enter, but that is about the only solution I know of.
    If you don't have the original, you probably need to export the file to a word processor or other text file and fix it there. You may have to reformat. That is likely easier than what you are trying to do, particularly if it is only a draft type document.

Maybe you are looking for

  • Getting Deployment error in Oracle 10g server

    Hii while deploying EAR in Oracle Enterprise Manager 10g. I am getting following error message and an resoluation message,which i could not able to proceed further. Deployment Failed : Another operation in progress which prevents your operation from

  • AR dunning even if document has an incoming payment method

    Hi, Our company have a situation where we need to dun documents even if there's an incoming payment method defined either in the customer master or in the document.   I know that the SAP standard behaviour says its not possible to dun these documents

  • ERROR after applying patch CSCtj01051: solaris9 CS 3.3 - LMS 3.2

    I installed a couple of LMS 3.2 point patches on a solaris 9 box. Afterwards the LMS did not started any more. DCRServer hang in "Waiting to initialize" and Apache failed to run. Also a couple of other processes failed (attached pdshow). Troublshooti

  • Web Dynpro and Abobe Flex

    Hi Folks, I've seen a couple of responses to questions about the mixing of Web Dynpro and Adobe Flex technologies... This thread mentions a "Flex Client" which is reportedly able to render existing Web Dynpro apps in Flex: WebDynPro ABAP in adobe fle

  • Exporting to Dreamweaver

    Hi I have recently made a navigation bar with pop-up menus in fireworks and now i want to export to dreamweaver. Just when i do that the slice grids are there, can i export to dreamweaver, keeping all the behaviours on the slices without the grids?