Jump to content

Recommended Posts

Posted

Hi

i need to delete a little part of a text help me

example:

the text is:

text1-

text2-

text3-

i want to delete:

text2-

how can i do that pls help

P.S. the text is in a .txt document

Posted (edited)

You don't properly explain. If you want to delete a specific string use StringReplace and replace it with an empty string ""

Edited by Inverted
Posted

  On 7/10/2009 at 3:02 PM, 'Inverted said:

You don't properly explain. If you want to delete a specific string use StringReplace and replace it with an empty string ""

Hi,

have a look at _ReplaceStringInFile

;-))

Stefan

Posted

  On 7/10/2009 at 8:37 PM, '99ojo said:

Hi,

have a look at _ReplaceStringInFile

;-))

Stefan

Thanks, i dont't understand stringreplace but _ReplaceStringInFile is understandable
Posted

Look at the example given in the helpfile:

$text = StringReplace("this is a line of text", " ", "-")
$numreplacements = @extended
MsgBox(0, "New string is", $text)
MsgBox(0, "The number of replacements done was", $numreplacements)

Line 1 is using the command. It replaces " " (any spaces between words) with "-" (a hyphen)

$numreplacements = @extended - The command returns the new string, and the number of replacements performed is stored in @extended.

By running the command, the variable $text will be changed from "this is a line of text" to "this-is-a-line-of-text". You see this in the first message box.

The second message box you see is the extended information. In this case the number "5" is returned for this is the number of times the " " was found and replaced.

Posted

  On 7/11/2009 at 1:57 PM, 'Volly said:

Look at the example given in the helpfile:

$text = StringReplace("this is a line of text", " ", "-")
$numreplacements = @extended
MsgBox(0, "New string is", $text)
MsgBox(0, "The number of replacements done was", $numreplacements)

Line 1 is using the command. It replaces " " (any spaces between words) with "-" (a hyphen)

$numreplacements = @extended - The command returns the new string, and the number of replacements performed is stored in @extended.

By running the command, the variable $text will be changed from "this is a line of text" to "this-is-a-line-of-text". You see this in the first message box.

The second message box you see is the extended information. In this case the number "5" is returned for this is the number of times the " " was found and replaced.

Yes okey

But i want to replace text in a file

so i think i better use _ReplaceStringInFile

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
  • Recently Browsing   0 members

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