PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Replace and UNICODE
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Replaces all occurrences of a specified substring in a string with another specified substring.
Remark: The initial character string is not modified.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
InitialString is string = "Abracadabra!"
ReplacedString is string = Replace(InitialString, "a", "o")
Info(ReplacedString) // Displays "Abrococobro!"
Versions 18 and later
WINDEVUniversal Windows 10 App
InitialString is string = "beetroot // apricot // strawberry / melon \ nuts / lemon"
ReplacedString is string = Replace(InitialString, ["//", "/", "\", "\\"], "-")
Trace(ReplacedString) // Displays "beetroot - apricot - strawberry - melon - nuts - lemon"


arrMyArray is array of 4 strings
arrMyArray[1] = "//"
arrMyArray[2] = "/"
arrMyArray[3] ="\"
arrMyArray[4] = "\\"
RemplacedString = Replace(InitialString, arrMyArray, "-")
Trace(ReplacedString) // Displays "beetroot - apricot - strawberry - melon - nuts - lemon"
New in version 18
WINDEVUniversal Windows 10 App
InitialString is string = "beetroot // apricot // strawberry / melon \ nuts / lemon"
ReplacedString is string = Replace(InitialString, ["//", "/", "\", "\\"], "-")
Trace(ReplacedString) // Displays "beetroot - apricot - strawberry - melon - nuts - lemon"


arrMyArray is array of 4 strings
arrMyArray[1] = "//"
arrMyArray[2] = "/"
arrMyArray[3] ="\"
arrMyArray[4] = "\\"
RemplacedString = Replace(InitialString, arrMyArray, "-")
Trace(ReplacedString) // Displays "beetroot - apricot - strawberry - melon - nuts - lemon"
WINDEVUniversal Windows 10 App
InitialString is string = "beetroot // apricot // strawberry / melon \ nuts / lemon"
ReplacedString is string = Replace(InitialString, ["//", "/", "\", "\\"], "-")
Trace(ReplacedString) // Displays "beetroot - apricot - strawberry - melon - nuts - lemon"


arrMyArray is array of 4 strings
arrMyArray[1] = "//"
arrMyArray[2] = "/"
arrMyArray[3] ="\"
arrMyArray[4] = "\\"
RemplacedString = Replace(InitialString, arrMyArray, "-")
Trace(ReplacedString) // Displays "beetroot - apricot - strawberry - melon - nuts - lemon"
Versions 19 and later
WINDEVLinuxUniversal Windows 10 App
InitialString is string = "Abracadabra!"
ReplacedString is string = Replace(InitialString, 4, 1, "o")
Trace(ReplacedString) // Displays "Abrocadabra!"
New in version 19
WINDEVLinuxUniversal Windows 10 App
InitialString is string = "Abracadabra!"
ReplacedString is string = Replace(InitialString, 4, 1, "o")
Trace(ReplacedString) // Displays "Abrocadabra!"
WINDEVLinuxUniversal Windows 10 App
InitialString is string = "Abracadabra!"
ReplacedString is string = Replace(InitialString, 4, 1, "o")
Trace(ReplacedString) // Displays "Abrocadabra!"
Syntax

Replacing a string with another string Hide the details

<Result> = Replace(<Initial string> , <String to replace> , <New string> [, <Option>])
<Result>: Character string
New string in which the specified strings have been replaced.
<Initial string>: Character string (with quotes)
String in which the specified strings will be replaced (maximum size: 2 GB).
<String to replace>: Character string (with quotes)
String to be replaced in the initial string.
If this parameter corresponds to an empty string (""), <Result> will correspond to <Initial string>.
<New string>: Character string (with quotes)
String that will replace <String to replace>.
If this parameter corresponds to an empty string (""), all the occurrences of <String to replace> will be deleted.
<Option>: Optional constant (or combination of constants)
Indicates the characteristics of the search for the word to replace:
WholeWordSearches for a whole word (between punctuation characters or spaces)
IgnoreCaseCase and accent insensitive search (ignores uppercase and lowercase differences).

The search is case sensitive by default: the search string must have the same case as the string to find in the initial string. To perform a case-insensitive search, use the IgnoreCase constant.
Versions 18 and later
WINDEVUniversal Windows 10 App

Replacing a set of strings with a new string Hide the details

<Result> = Replace(<Initial string> , <Array of strings to replace> , <New string> [, <Option>])
<Result>: Character string
New string in which the specified strings have been replaced.
<Initial string>: Character string (with quotes)
String in which the specified strings will be replaced (maximum size: 2 GB).
<Array of strings to replace>: Array
Array of strings to be replaced in <Initial string>. This array can correspond to:
  • an Array variable.
  • an array in the following format: [Value1, Value2, ... , Value N].
If this parameter corresponds to an empty string (""), <Result> will correspond to <Initial string>.
<New string>: Character string (with quotes)
String that will replace all the strings specified in <Array of strings to replace>.
If this parameter corresponds to an empty string (""), all the occurrences of <String to replace> will be deleted.
<Option>: Optional constant (or combination of constants)
Indicates the characteristics of the search for the words to replace:
WholeWordSearches for a whole word (between punctuation characters or spaces)
IgnoreCaseCase and accent insensitive search (ignores uppercase and lowercase differences).

The search is case sensitive by default: the search string must have the same case as the string to find in the initial string. To perform a case-insensitive search, use the IgnoreCase constant.
New in version 18
WINDEVUniversal Windows 10 App

Replacing a set of strings with a new string Hide the details

<Result> = Replace(<Initial string> , <Array of strings to replace> , <New string> [, <Option>])
<Result>: Character string
New string in which the specified strings have been replaced.
<Initial string>: Character string (with quotes)
String in which the specified strings will be replaced (maximum size: 2 GB).
<Array of strings to replace>: Array
Array of strings to be replaced in <Initial string>. This array can correspond to:
  • an Array variable.
  • an array in the following format: [Value1, Value2, ... , Value N].
If this parameter corresponds to an empty string (""), <Result> will correspond to <Initial string>.
<New string>: Character string (with quotes)
String that will replace all the strings specified in <Array of strings to replace>.
If this parameter corresponds to an empty string (""), all the occurrences of <String to replace> will be deleted.
<Option>: Optional constant (or combination of constants)
Indicates the characteristics of the search for the words to replace:
WholeWordSearches for a whole word (between punctuation characters or spaces)
IgnoreCaseCase and accent insensitive search (ignores uppercase and lowercase differences).

The search is case sensitive by default: the search string must have the same case as the string to find in the initial string. To perform a case-insensitive search, use the IgnoreCase constant.
WINDEVUniversal Windows 10 App

Replacing a set of strings with a new string Hide the details

<Result> = Replace(<Initial string> , <Array of strings to replace> , <New string> [, <Option>])
<Result>: Character string
New string in which the specified strings have been replaced.
<Initial string>: Character string (with quotes)
String in which the specified strings will be replaced (maximum size: 2 GB).
<Array of strings to replace>: Array
Array of strings to be replaced in <Initial string>. This array can correspond to:
  • an Array variable.
  • an array in the following format: [Value1, Value2, ... , Value N].
If this parameter corresponds to an empty string (""), <Result> will correspond to <Initial string>.
<New string>: Character string (with quotes)
String that will replace all the strings specified in <Array of strings to replace>.
If this parameter corresponds to an empty string (""), all the occurrences of <String to replace> will be deleted.
<Option>: Optional constant (or combination of constants)
Indicates the characteristics of the search for the words to replace:
WholeWordSearches for a whole word (between punctuation characters or spaces)
IgnoreCaseCase and accent insensitive search (ignores uppercase and lowercase differences).

The search is case sensitive by default: the search string must have the same case as the string to find in the initial string. To perform a case-insensitive search, use the IgnoreCase constant.
Versions 19 and later
WINDEVUniversal Windows 10 App

Replacing part of string with a new string Hide the details

<Result> = Replace(<Initial string> , <Position> , <Length> , <New string>)
<Result>: Character string
New string in which the specified part of string has been replaced.
<Initial string>: Character string (with quotes)
String in which the specified part of string will be replaced (maximum size: 2 GB).
<Position>: Integer
Position of the part of string to replace.
<Length>: Integer
Length of the part of string to replace.
<New string>: Character string (with quotes)
String that will replace the specified part of string.
New in version 19
WINDEVUniversal Windows 10 App

Replacing part of string with a new string Hide the details

<Result> = Replace(<Initial string> , <Position> , <Length> , <New string>)
<Result>: Character string
New string in which the specified part of string has been replaced.
<Initial string>: Character string (with quotes)
String in which the specified part of string will be replaced (maximum size: 2 GB).
<Position>: Integer
Position of the part of string to replace.
<Length>: Integer
Length of the part of string to replace.
<New string>: Character string (with quotes)
String that will replace the specified part of string.
WINDEVUniversal Windows 10 App

Replacing part of string with a new string Hide the details

<Result> = Replace(<Initial string> , <Position> , <Length> , <New string>)
<Result>: Character string
New string in which the specified part of string has been replaced.
<Initial string>: Character string (with quotes)
String in which the specified part of string will be replaced (maximum size: 2 GB).
<Position>: Integer
Position of the part of string to replace.
<Length>: Integer
Length of the part of string to replace.
<New string>: Character string (with quotes)
String that will replace the specified part of string.
Remarks

Replace and UNICODE

<Initial string>, <String to replace> and <New string> can correspond to:
  • ANSI strings.
  • UNICODE strings.
  • buffers.
You have the ability to use ANSI strings, Unicode strings and buffers in the different parameters of the function.
The following conversion rule is used for the Ansi systems (Windows or Linux):
  • If at least one of the strings is a buffer, all the strings are converted to buffers and the operation is performed with buffers.
  • If the first condition is not met and there is at least one Unicode string, all the strings are converted to Unicode and the operation is performed in Unicode (the conversion is performed with the current character set, if necessary).
  • Otherwise, the operation is performed in Ansi.
The following conversion rule is used for the Unicode systems (Windows CE):
  • If at least one of the strings is a buffer, all the strings are converted to buffers and the operation is performed with buffers.
  • Otherwise, the operation is performed in Unicode.
For more details on UNICODE, see Managing UNICODE.
Reminder: The linguistic parameters used are defined during the call to ChangeCharset.
Component: wd260vm.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
video windev replace
https://youtu.be/m1cKtL-KeoU
amarildo
03 Dec. 2018
retirar qrcode
s_qrcode_xml is string=[
<![CDATA[http://hnfe.sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx?]]>
]
s_qrcode_xml=Replace(s_qrcode_xml,"<![CDATA[","")
s_qrcode_xml=Replace(s_qrcode_xml,"]]>","")
EDT_resultado=s_qrcode_xml

// BLOG COM VIDEO E EXEMPLO

http://windevdesenvolvimento.blogspot.com.br/2017/09/aula-1254-xml-014-retirar-qrcode_3.html

https://www.youtube.com/watch?v=lYTEg4sdZa0

De matos
03 Sep. 2017