str logo
String v1.0.0, Oct 28 22


Explore with Pulumi AI

Replace returns a copy of the string s with all non-overlapping instances of old replaced by new. If old is empty, it matches at the beginning of the string and after each UTF-8 sequence, yielding up to k+1 replacements for a k-rune string.

Using replace

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function replace(args: ReplaceArgs, opts?: InvokeOptions): Promise<ReplaceResult>
function replaceOutput(args: ReplaceOutputArgs, opts?: InvokeOptions): Output<ReplaceResult>
def replace(new: Optional[str] = None,
            old: Optional[str] = None,
            string: Optional[str] = None,
            opts: Optional[InvokeOptions] = None) -> ReplaceResult
def replace_output(new: Optional[pulumi.Input[str]] = None,
            old: Optional[pulumi.Input[str]] = None,
            string: Optional[pulumi.Input[str]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[ReplaceResult]
func Replace(ctx *Context, args *ReplaceArgs, opts ...InvokeOption) (*ReplaceResult, error)
func ReplaceOutput(ctx *Context, args *ReplaceOutputArgs, opts ...InvokeOption) ReplaceResultOutput

> Note: This function is named Replace in the Go SDK.

public static class Replace 
    public static Task<ReplaceResult> InvokeAsync(ReplaceArgs args, InvokeOptions? opts = null)
    public static Output<ReplaceResult> Invoke(ReplaceInvokeArgs args, InvokeOptions? opts = null)
public static CompletableFuture<ReplaceResult> replace(ReplaceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
  function: str:replace
    # arguments dictionary

The following arguments are supported:

New string
Old string
String string
New string
Old string
String string
new_ String
old String
string String
new string
old string
string string
new str
old str
string str
new String
old String
string String

replace Result

The following output properties are available:

Result string
Result string
result String
result string
result str
result String

Package Details

str pulumi/pulumi-str