Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) StringBuilder SetNthDemonstrates the SetNth method.
; The SetNth method is handy for setting a part of a delimited string. ; For example: $oSb = ObjCreate("Chilkat.StringBuilder") $oSb.Append("red,blue,""green,purple"",,yellow") Local $sDelimiterChar = "," Local $bExceptDoubleQuoted = True Local $bExceptEscaped = True $oSb.SetNth(2,"magenta",$sDelimiterChar,$bExceptDoubleQuoted,$bExceptEscaped) ; Prints "red,blue,magenta,,yellow" ConsoleWrite($oSb.GetAsString() & @CRLF) $oSb.SetNth(3,"orange",$sDelimiterChar,$bExceptDoubleQuoted,$bExceptEscaped) ; Prints "red,blue,magenta,orange,yellow" ConsoleWrite($oSb.GetAsString() & @CRLF) ; What happens if we start with an empty string? $oSb.Clear $oSb.SetNth(2,"apple",$sDelimiterChar,$bExceptDoubleQuoted,$bExceptEscaped) ; Prints ",,apple" ConsoleWrite($oSb.GetAsString() & @CRLF) $oSb.SetNth(0,"orange",$sDelimiterChar,$bExceptDoubleQuoted,$bExceptEscaped) ; Prints "orange,,apple" ConsoleWrite($oSb.GetAsString() & @CRLF) $oSb.SetNth(1,"banana",$sDelimiterChar,$bExceptDoubleQuoted,$bExceptEscaped) ; Prints "orange,banana,apple" ConsoleWrite($oSb.GetAsString() & @CRLF) |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.