Jump to content

Search the Community

Showing results for tags 'replacecharacterinstring'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hi All, I have written a UDF for one of my requirement which replaces a single character in string with a sub string/another character. I am using this for my requirement by calling below function as StrReplace("C:\Software\Autoit\Substr","\","\\") and gives result as C:\\Software\\Autoit\\Substr Please let me know if this can be improvised or any mistakes to correct. ;=============================================================================== ; ; Function Name: StrReplace($INPUT_STRING) ; Description: This function is to replace a character with another in a string. ; Parameter(s): $INPUT_STRING - Original String Value ; $STR_2_FIND - Single Character to find the $INPUT_STRING ; $STR_2_REPLACE - Substring/Multiple Characters to replace in place of $STR_2_FIND value ; Requirement(s): Replacing one single Character in a string with multiple Characters ; Return Value(s): success - Output string after replacing a character with required character ; failure - 0 ; Author(s): smartkey ; ;=============================================================================== Func StrReplace($INPUT_STRING, $STR_2_FIND, $STR_2_REPLACE) Local $OUTPUT_STRING = "" If StringLen($INPUT_STRING) > 0 Then If StringMid($INPUT_STRING,1,1) = $STR_2_FIND Then $OUTPUT_STRING = $OUTPUT_STRING & $STR_2_REPLACE Else $OUTPUT_STRING = StringMid($INPUT_STRING,1,1) EndIf For $i=2 to StringLen($INPUT_STRING) If StringMid($INPUT_STRING,$i,1) = $STR_2_FIND Then $OUTPUT_STRING= $OUTPUT_STRING & $STR_2_REPLACE Else $OUTPUT_STRING= $OUTPUT_STRING & StringMid($INPUT_STRING,$i,1) EndIf Next Return $OUTPUT_STRING Else Return 0 EndIf EndFunc
×
×
  • Create New...