FredixBlog


Just my log about anything I could find enjoyable.



Clear all line breaks

author Posted by: fredometro on date Jan 6th, 2004 | filed Filed under: MS-Access

Quertion: Can anyone figure out a little function that will clear all line breaks (Chr(10)+Chr(13)) in a string?
Matt(+)

Fredix gave this response on 1/17/2002:
Hi!

Here is a function I use:


Public Function ClearBreaks(TheString)
dim ch, result as string
dim i as integer

    result = ""
    if len(TheString) = 0 then
        ClearBreaks = ""
        exit function
    end if

    for i = 1 to len(TheString)
        ch = mid(TheString,i,1)
        if ch <> chr(13) and ch <> chr(10) then
            result = result & ch
        else
            if ch = chr(13) then result = result & " "
        end if
    next i

    ClearBreaks = result

end function

With this, you will have the line breaks replaced by a space.

Regards.

No related posts.

     Add A Comment

You must be logged in to post a comment.


Warning: include(/home/www/web421/html/phpTraffic/write_logs.php) [function.include]: failed to open stream: No such file or directory in /home/websitef/public_html/fredometro.com/wp-content/themes/blueshadow/footer.php on line 15

Warning: include() [function.include]: Failed opening '/home/www/web421/html/phpTraffic/write_logs.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/websitef/public_html/fredometro.com/wp-content/themes/blueshadow/footer.php on line 15