Sign in to follow this  
Followers 0
stuka

....

9 posts in this topic

#1 ·  Posted (edited)

.

Edited by stuka

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Hi,

Global $test = 'Ich weiß, daß ist nur ein ÜÖÄ ||| üöä Test ü, ö, ä, ÄÖÜ :-(!'
ConsoleWrite(_changeString($test, 'Ü|Ö|Ä|ü|ö|ä|ß|(| ', 'Ue|Oe|Ae|ue|oe|ae|ss|)|_') & @CRLF)
ConsoleWrite(_changeString($test, 'Ü|CH', 'Ue|CH!') & @CRLF)
ConsoleWrite(_changeString($test, 'ch@|', 'ch@', 0, 1, '@') & @CRLF)

;===============================================================================
; Function Name: _changeString
; Description::    Replace multiple Strings like StringReplace
; Parameter(s):    Like StringReplace. $searchstring and $replacestring with |
; Requirement(s): ---    
; Return Value(s): new string
;                    -1 = no | found
;                    -2 = string count do not match
;                    -3 = case should be 0,1,2
; Author(s): Thorsten Meger (Xenobiologist)
;===============================================================================
Func _changeString($string, $searchstring, $replacestring, $count = 0, $case = 0, $delim = '|')
    If Not StringInStr($searchstring, $delim) Or Not StringInStr($replacestring, $delim) Then Return -1
    Local $searchstring_A = StringSplit($searchstring, $delim), $replacestring_A = StringSplit($replacestring, $delim)
    If UBound($searchstring_A) <> UBound($replacestring_A) Then Return -2
    If $case < 0 Or $case > 2 Then Return -3
    For $i = 1 To UBound($searchstring_A) - 1
        $string = StringReplace($string, String($searchstring_A[$i]), String($replacestring_A[$i]), $count, $case)
    Next
    Return $string
EndFunc   ;==>_changeString

Mega

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

I see what you mean, you almost have to read in the entire file and replace one character at a time.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

That's exactly what I'm trying to do... but i can't figure out how to do it...will replacing one alphabet at a time take a long time?

Umm it depends on how large your file is. Why don't you just get a new keyboard? They are like $6 on Newegg.

Edited by weaponx

Share this post


Link to post
Share on other sites

Hi,

yes replacing a letter replaced before can be a problem. Why not changing it to something like @@1@@ and @@2@@ and so on. And at the end you replace all the @@...@@ with what you need.

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

yes replacing a letter replaced before can be a problem. Why not changing it to something like @@1@@ and @@2@@ and so on. And at the end you replace all the @@...@@ with what you need.

Mega

Or, simply use 2 files... input and output

Or, store data in an array, place modifications in second array, then output second array to data file...


Everseeker

Share this post


Link to post
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
Sign in to follow this  
Followers 0