-
-
Notifications
You must be signed in to change notification settings - Fork 18
Replace
Xusinboy Bekchanov edited this page Nov 6, 2023
·
9 revisions
Returns a string, which is a substring of a string expression beginning at the start position (defaults to 1), in which a specified substring has been replaced with another substring a specified number of times.
UString
The Return value of the Replace function is a string, with substitutions made, that begins at the position specified by Start and concludes at the End of the Expression string. It's not a copy of the original string from start to finish.
Function Replace(ByRef Expression As WString, ByRef FindingText As WString, ByRef ReplacingText As WString, ByVal Start As Integer = 1, ByRef Count As Integer = 0, MatchCase As Boolean = True) As UString
Part | Type | Description |
Expression
|
WString | Required. String expression containing substring to replace. |
FindingText
|
WString | Required. Substring being searched for. |
ReplacingText
|
WString | Required. Replacement substring. |
Start
|
Integer | Optional. Start position for the substring of Expression to be searched and returned. If omitted, 1 is assumed. |
Count
|
Integer | Optional. Number of substring substitutions to perform. If omitted, the default value is -1, which means, make all possible substitutions. |
MatchCase
|
Boolean | Optional. Boolean value indicating the kind of comparison to use when evaluating substrings. |
Replace returns the following values:
If | Replace returns |
Expression is zero-length | Zero-length string ("") |
Expression is NULL | An error. |
FindingText is zero-length | Copy of Expression. |
ReplacingText is zero-length | Copy of Expression with all occurrences of FindingText removed. |
Start > Len(Expression) | Zero-length string. String replacement begins at the position indicated by Start. |
Count is 0 | Copy of Expression. |
#include "mff/UString.bi"
Dim strFull As String = "My name is Adam"
Print Replace(strFull, "Adam", "Victor")
Sleep
- Table of Contents
- Controls and objects
- Controls
- Animate
- Chart
- CheckBox
- CheckedListBox
- ComboBoxEdit
- ComboBoxEx
- CommandButton
- DateTimePicker
- Grid
- Header
- HotKey
- HScrollBar
- ImageBox
- IPAddress
- Label
- LinkLabel
- ListControl
- ListView
- MonthCalendar
- PageScroller
- ProgressBar
- RadioButton
- ReBar
- RichTextBox
- ScrollBarControl
- Splitter
- StatusBar
- TextBox
- ToolBar
- ToolPalette
- TrackBar
- TreeListView
- TreeView
- UpDown
- VScrollBar
- WebBrowser
- Containers
- Components
- Dialogs
- Controls
- Functions and methods
- Numeric functions
- String functions
- Pointer functions