LogoLogo
Github
  • Overview
    • 📄Litepaper
  • GraphLinq Chain
    • Networks
      • Specs
        • Geth Client
        • Clique Consensus
      • GraphLinq Chain (Mainnet)
        • Wallet
          • Add GraphLinq Chain to Metamask
          • Add GraphLinq Chain To Ledger
        • RPC Public Nodes
        • Json-RPC API
        • Libraries
        • Execution Clients
        • Explorer
        • Status
    • GLQ
      • Allocation
      • Bridge
      • Rewards
  • 🎶Run a node
    • Installation
  • Dev tooling
    • Introduction
      • Vision
    • Graphs
      • What are Graphs and how do they work?
      • Creating a graph
      • File compression
      • Graph Cycle Costs
      • Node & Fees
    • Engine
      • Setting up the environment
      • Running an Engine locally
    • Dashboard Interface
      • Importing Graph/Template
      • Deploying a Graph
      • Managing Graph State
    • Blocks
      • Base Variable
        • Boolean
        • Decimal
        • Integer
        • KeyValue
        • Long
        • String
        • Get variable
        • Is Variable Exist
        • Set variable
        • Variable Portal
        • Secret String
      • Common
        • Entry Point
        • On Graph Start
        • Stop Graph
      • Time
        • Get Milliseconds Timestamp
        • Get Milliseconds Timestamp Offset
        • Get Timestamp
        • Get Timestamp Offset
        • Timer
        • Format Date
        • Millisecond Timestamp to Date
        • Timestamp to Date
        • Execution Time Interval
      • JSON
        • Last Node to JSON
        • Convert To JSON
        • Add JSON Property
        • Create JSON Object
        • JSON Deserialize To Array
        • JSON to JSON Object
        • Merge JSON
        • Serialize JSON Object
        • Serialize to JSON
      • Log
        • Print
      • WebSocket
        • WebSocket Client Close
        • WebSocket Client Connector
        • On WebSocket Client Disconnect
        • WebSock Receive Data Event
        • WebSocket Send Data
      • String
        • String Contains
        • Concat String
        • Replace String in String
      • Math
        • Subtract A - B
        • Add A + B
        • Ceiling
        • Divide A / B
        • Floor
        • Modulo A % B
        • Multiply A * B
        • Percentage Difference
        • Round
      • HTTP
        • Array To Body Values
        • Array To JSON Body
        • Put HTTP Request
        • Post HTTP Request
        • Get HTTP Request
        • Delete HTTP Request
      • Function
        • Function Block
        • Add Function Parameter
        • Set Function Result
        • Call Function
        • Get Function Result Parameter
        • Get Function Parameter
      • Transformers
        • String to Base64
      • Data
      • CSV
      • Base Condition
        • Decimal Branch
        • Integer Branch
        • String Branch
        • Boolean Branch
      • Range Condition
        • Decimal Range Branch
      • Array
        • Add Array Element
        • Clear Array
        • Create Array
        • Each Element In Array
        • Get Array Element At Index
        • Get Array Size
        • Keep Last X Elements In Array
      • Dictionary
      • Hosted API
    • Blocks (Messaging)
      • Twitter
      • Twitch
      • Telegram
      • SMTP
      • ShortenURL
      • PushOver
      • PushBullet
      • OpenAI
      • Discord
        • Add Emoji On Message
        • Send Discord Channel File
        • Add Role User
        • On Discord Channel Message
        • On Reaction Added Message
        • On Reaction Removed Message
        • Remove Role User
        • Reply Private Discord Message
        • Send Discord Channel Message
        • Discord Connector
        • On Discord Private Message
    • Blocks (Exchange)
      • Binance
      • Bitfinex
      • Bittrex
      • CoinEx
      • CoinGecko
        • Get CoinGecko Coin
      • Huobi
      • Kraken
      • KuCoin
      • LiveCoinWatch
      • MXC
    • Blocks (Blockchains)
      • Avalanche
        • Network Blocks
          • Avalanche Connector
          • Get Block Parameters
          • Get Transaction Parameters
          • On Avalanche Block
          • On Avalanche Transaction
        • Avascan
          • Get Avascan Supply
          • Get Avascan Global Stats
          • Get Avascan Staking Stats
          • Get Avascan Burned Fees
        • SnowTrace
          • SnowTrace Connector
          • Get ERC-20 Balance For Contract
          • Get ERC-20 Token Supply
          • Get Total AVAX on C-Chain
          • Get AVAX Balance Single Address
      • Binance Smart Chain
        • Network Blocks
          • Binance Smart Chain Connector
          • On Binance Smart Chain Block
          • On Binance Smart Chain Transaction
          • On Binance Smart Chain Wallet Transaction
        • BEP20 Blocks
          • Create BEP20 Token
          • Deploy BEP20 Token
      • Elrond
        • Elrond Connector
        • Get Elrond HyperBlock By Hash
        • Get Elrond Transaction
        • Get Elrond Wallet Balance
      • Ethereum
        • Ethereum Connector
        • On Ethereum Block
        • On Ethereum Transaction
        • On Ethereum Wallet Transaction
        • Estimate Gas Price
        • Get Ether Balance
        • Get Block Parameters
        • Get Transaction Parameters
        • Etherscan
          • Etherscan Connector
          • Etherscan Get Gas Price
        • Ethereum Managed Wallet
          • Get Personal Managed Wallet
        • Ethereum ERC20
          • Get ERC20 Holders
          • Get ERC20 Balance
          • Get ERC20 Information
          • Create ERC20 Token
          • Deploy ERC20 Token
        • Ethereum NFT
          • Create NFT Contract
          • Deploy NFT Contact
          • Create New Mintable NFT Token
          • Deploy New Mintable NFT Token
      • Polygon
        • Polygon Connector
      • Quickswap
        • Get Quickswap Pair Price
        • Get Quickswap Token Price
        • Get Quickswap LP Token
        • Get Quickswap LP Token Price
        • On Quickswap Swap
        • On Quickswap Sync
      • Unicrypt
        • Get Unicrypt Locked Token Parameters
        • Get Unicrypt Locked Tokens
        • Get Unicrypt Total Locked Liquidity
        • Get Unicrypt All LP Locked Tokens Address
        • On Unicrypt Deposit
      • Uniswap
        • Get Uniswap LP Token
        • Get Uniswap LP Token Price
        • Uniswap Get Pair Price
        • Get Uniswap Token Price
        • On Uniswap Swap
        • On Uniswap Sync
      • Solana
    • Blocks (Charting)
      • Generate Time Series One Line Chart
      • Generate Time Series Two Line Chart
    • Blocks (Machine Learning)
      • Spam Detection
      • Sentiment Analysis
    • Node Connector Colors
      • Strings & Variables
      • Execution Logic (Yellow)
      • Integers (orange)
      • Booleans (pink)
    • Block Execution Order
      • Additional Block Execution
    • Block Color
      • Colors & Meaning
    • Block Type Overview
      • Function Type
      • Entry Point Type
      • Event Trigger Type
      • Variable Type
      • Condition Type
      • Connector Type
  • Nocode Users
    • Instant Deploy Wizard
    • GraphLinq Marketplace
  • Twitter
  • Medium
  • Github
  • GraphLinq Explorer
  • Audit Report
Powered by GitBook
On this page
  • Block Description
  • Output
  • Example Use Case
  • More Information
  • Full Example
  1. Dev tooling
  2. Blocks
  3. String

Replace String in String

Replace occurrences of a specified substring in a given input string with a new string

PreviousConcat StringNextMath

Last updated 1 year ago

The block in the GraphLinq IDE is a powerful tool that allows developers to modify strings by replacing specific substrings with new content. This block is invaluable for performing string manipulation and transforming text-based data within graphs. It provides essential functionalities for efficiently modifying strings and adapting them to various scenarios.

Block Description

The block is part of the category in the GraphLinq IDE. Its primary function is to replace occurrences of a specified substring in a given input string with a new string. This enables developers to make precise modifications to textual data within their graphs.

Input Parameters: The block requires three input parameters:

  1. Input String (String Type): This parameter represents the original input string that contains the substrings to be replaced.

  2. Search String (String Type): The Search String input represents the substring to be searched for in the input string. Whenever this substring is found, it will be replaced with the new string.

  3. Replace With String (String Type): The Replace With String input is the new content that will replace all occurrences of the Search String in the Input String.

Output

The output of the Replace String In String block is a modified version of the original Input String with all instances of the Search String replaced with the Replace With String. The output string is the result of the precise replacements performed by this block.

Example Use Case

Let's explore a practical example to illustrate how the Replace String In String block can be used in a graph:

  1. The graph receives data from an external source that contains user feedback.

  2. The Input String variable stores this user feedback.

  3. The Search String is set to identify specific keywords or phrases, such as "bad," "disappointed," or "unhappy."

  4. The Replace With String is set to a more positive and uplifting phrase, such as "great," "satisfied," or "happy."

  5. The Replace String In String block then processes the Input String and replaces all instances of the negative keywords with the positive phrases.

  6. The final output from the Replace String In String block will be the user feedback with all negative words replaced with positive ones, creating a more positive and encouraging message.

The Replace String In String block is an essential tool in the GraphLinq IDE for efficiently modifying textual data within graphs. Its ability to replace specific substrings in an input string with new content allows developers to perform precise string manipulation and tailor responses to various scenarios. By utilizing the Replace String In String block, developers can enhance user interactions, provide more personalized feedback, and create more engaging and user-friendly applications.


More Information

Usage

Example

Advantages

Summary


Full Example

Replace String in String blocks allow us to replace all instances of a specific substring found within some string with a third string. They have three inputs: "Original" is the main string, "ToReplace" is the substring that we are searching for within "Original", and "ReplaceText" is the string that we want to replace every instance of "ToReplace" with.

Replace String in String blocks are commonly used to add some data that is acquired or calculated during runtime to some kind of message tempate, as we do here:

This produces:

We could have used any string for our placeholder here; we used "{0}" because it is conventional. Note that if more than one instance of "{0}" (or whatever your "ToReplace" string is) exists in the original string, they will all be replaced with the "ReplaceText" string. Also note that we are allowed to put integer or decimal type data in the "ReplaceText" input parameter, as we do above with Bitcoin's price. The numeric data will be converted to string data behind the scenes before it is substituted into the original string. Below is an example of chaining several Replace String in String blocks to create an output message containing many pieces of data:

This produces:

This kind of technique would likely be used for any kind of bot that is supposed to output a bunch of stats about some coin or token when prompted.

In this example, the block enables the graph to process user feedback and transform it into more positive and constructive responses. This empowers developers to improve user experiences by providing more encouraging and supportive interactions with their applications.

The block is a crucial element in the GraphLinq IDE that allows developers to modify strings by replacing specific substrings with new content. It is useful for performing string manipulation and transforming text-based data in graphs.

The block requires three string inputs: the original string, the substring to be replaced, and the new content that will replace the substring. The block then searches for occurrences of the substring within the original string and replaces all occurrences with the new content.

Let's illustrate the usage of the block with an example. Suppose we have a string "I enjoy GraphLinq," and we want to replace "enjoy" with "love." By using the block with the original string as "I enjoy GraphLinq," the substring to be replaced as "enjoy," and the new content as "love," the block will output the modified string "I love GraphLinq."

The block provides a powerful mechanism for manipulating strings within graphs. It enables developers to replace specific text patterns, correct data, or tailor messages dynamically based on changing requirements.

The block in the GraphLinq IDE offers a valuable feature for altering strings by replacing designated substrings with new content. It facilitates string transformation, data correction, and dynamic message generation within graphs, enhancing the overall flexibility and functionality of graph designs.

In the example above, we use the string "{0}" as a sort of placeholder in our original string. We then search for "{0}" using our Replace String in String block, and replace that string with whatever price is returned by the block.

Replace String In String
Replace String In String
String
Replace String In String
Replace String In String
Replace String in String
Replace String in String
Replace String in String
String
Replace String in String
Replace String in String
Get CoinGecko Coin