Jump to content

How to add link breaks?


Recommended Posts

What is this random number of sentences all about?

$open= FileOpen('input.txt', 128)
If @error Then Exit
$update=FileOpen('output.txt',BitOR(128, 8, 1))
If @error Then Exit
$text=FileRead($open)

StringReplace($text, @CR, "")
StringReplace($text, @LF, "")
$text = StringStripWS($text, 3)
If StringRight($text, 1) = "." Then $text = StringTrimRight($text, 1)
$sens = StringSplit($text,".",1)

$sString = ""
For $i = 1 To $sens[0]
    For $j = 1 To Random(3,6,1)
        If $i > $sens[0] Then ExitLoop
        $sString &= $sens[$i] & "."
        $i += 1
    Next
    $sString &= @CRLF
    $i -= 1
Next
FileWrite($update, $sString)
Edited by czardas
Link to comment
Share on other sites

What is this random number of sentences all about?

$open= FileOpen('input.txt', 128)
If @error Then Exit
$update=FileOpen('output.txt',BitOR(128, 8, 1))
If @error Then Exit
$text=FileRead($open)

StringReplace($text, @CR, "")
StringReplace($text, @LF, "")
$text = StringStripWS($text, 3)
If StringRight($text, 1) = "." Then $text = StringTrimRight($text, 1)
$sens = StringSplit($text,".",1)

$sString = ""
For $i = 1 To $sens[0]
    For $j = 1 To Random(3,6,1)
        If $i > $sens[0] Then ExitLoop
        $sString &= $sens[$i] & "."
        $i += 1
    Next
    $sString &= @CRLF
    $i -= 1
Next
FileWrite($update, $sString)

Great ! Thanks

But it has a space in the top lines.

For Example:

Sentence1. Sentence2.
 Sentence3. Sentence4. Sentence5.
 Sentence6. Sentence7.
 Sentence8. Sentence9. Sentence10.
 Sentence11. Sentence12.
 Sentence13. Sentence14.
 Sentence15.
Edited by kegiaumat055
Link to comment
Share on other sites

You found the root of the problem. What you have also strips spaces between all sentences. I came up with a slightly different solution. Anyway, you were definately on the right track ;)

$open= FileOpen('input.txt', 128)
If @error Then Exit
$update=FileOpen('output.txt',BitOR(128, 8, 1))
If @error Then Exit
$text=FileRead($open)

StringReplace($text, @CR, "")
StringReplace($text, @LF, "")
$text = StringStripWS($text, 3)
If StringRight($text, 1) = "." Then $text = StringTrimRight($text, 1)
$sens = StringSplit($text,".",1)

$sString = ""
For $i = 1 To $sens[0]
    For $j = 1 To Random(3,6,1)
        If $i > $sens[0] Then ExitLoop
        $sString &= StringStripWS($sens[$i], 3) & ". "
        $i += 1
    Next
    $sString &= @CRLF
    $i -= 1
Next
FileWrite($update, $sString)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...