Solution number three:

  • Store whitelisted domains in mapping (string => bool) whitelisted
  • Find out if a given domain is whitelisted, using if (whitelisted[domain])
Answer from goodvibration on Stack Exchange
🌐
GitHub
github.com › Arachnid › solidity-stringutils
GitHub - Arachnid/solidity-stringutils: Basic string utilities for Solidity · GitHub
Returns True if self contains needle. ... Returns True if needle is found in self, false otherwise. Returns a newly allocated string containing the concatenation of self and other.
Starred by 1.2K users
Forked by 374 users
Languages   Solidity 99.7% | Makefile 0.3%
🌐
Medium
medium.com › coinmonks › solidity-strings-f3d0f761c1d5
Solidity Strings
June 23, 2022 - String is a reference type in solidity, which means that when you define one you have to specify its location (unless it is a state variable) : storage, memory or calldata. They can only contain ASCII printable characters (between 0x20 and 0x7E) and ...
🌐
GeeksforGeeks
geeksforgeeks.org › solidity › solidity-strings
Solidity - Strings - GeeksforGeeks
July 23, 2025 - In Solidity data types are classified into two categories: Value type and Reference type. Strings in Solidity is a reference type of data type which stores the location of the data instead of directly storing the data into the variable.
🌐
JamesBachini.com
jamesbachini.com › solidity-strings
Strings in Solidity | Solidity Tips & Examples – JamesBachini.com
March 19, 2023 - This article aims to provide a ... A string is a sequence of characters represented in UTF-8 encoding. It can contain any Unicode character and has no fixed size, meaning it can grow dynamically as needed....
🌐
GitHub
github.com › wx7063 › solidity-strings
GitHub - wx7063/solidity-strings: solidity string function: join, contains, find, replace, remove, concat
solidity string function: join, contains, find, replace, remove, concat - GitHub - wx7063/solidity-strings: solidity string function: join, contains, find, replace, remove, concat
Author   wx7063
🌐
LinkedIn
linkedin.com › pulse › bytes-vs-strings-solidity-ion-platon
Bytes vs Strings in Solidity
February 18, 2023 - A string can contain any sequences of characters visible or invisible, and characters may be repeated. Solidity supports string literal using both double quote (" ") and single quote (' ').
🌐
TutorialsPoint
tutorialspoint.com › solidity › solidity_strings.htm
Solidity - Strings
In above example, "test" is a string literal and data is a string variable. More preferred way is to use byte types instead of String as string operation requires more gas as compared to byte operation. Solidity provides inbuilt conversion between bytes to string and vice versa.
Find elsewhere
🌐
HackerNoon
hackernoon.com › working-with-strings-in-solidity-c4ff6d5f8008
Working with Strings in Solidity | HackerNoon
July 17, 2018 - This is the first in a series of blogs we’re going to bring to you directly from the trenches, going into some of the nitty-gritty technical detail of some of the things we’re doing with the Protocol at the moment.
🌐
GitHub
github.com › Arachnid › solidity-stringutils › blob › master › src › strings.sol
solidity-stringutils/src/strings.sol at master · Arachnid/solidity-stringutils
* modifying s to only contain the remainder of the string after the '.'. * In situations where you do not want to modify the original slice, you · * can make a copy first with `.copy()`, for example: * `s.copy().split(".")`. Try and avoid using this idiom in loops; since · * Solidity has no memory management, it will result in allocating many ·
Author   Arachnid
🌐
WhiteboardCrypto
whiteboardcrypto.com › home › solidity strings
Solidity Strings - WhiteboardCrypto
November 16, 2023 - //SPDX-License-Identifier: MIT ... encoded with the UTF-8 protocol. These can contain any ASCII character, as well as unicode literals like emojis if properly declared....
🌐
Solidity
docs.soliditylang.org › en › v0.5.3 › frequently-asked-questions.html
Frequently Asked Questions — Solidity 0.5.3 documentation
For now, if you want to modify a string (even when you only want to know its length), you should always convert it to a bytes first: pragma solidity >=0.4.0 <0.6.0; contract C { string s; function append(byte c) public { bytes(s).push(c); } function set(uint i, byte c) public { bytes(s)[i] = c; } }
🌐
Stack Exchange
ethereum.stackexchange.com › questions › 97394 › check-if-calldata-contains-string
solidity - Check if calldata contains string - Ethereum Stack Exchange
April 17, 2021 - function checker(address _from, uint _value, bytes calldata _data) external{ //HOW to check if _data contains "SOMETHING"? } ... if(string(_data) == ("SOMETHING")){...}; if(string(_data) == ("0x534f4d455448494e470a")){...}; // SOMETHING in hex if(_data == 0x534f4d455448494e470a){...} if(_data == hex"SOMETHING"){...} if(_data == hex"534f4d455448494e470a"){...}
🌐
DEV Community
dev.to › shlok2740 › string-type-and-string-literals-in-solidity-mag
String Type and String Literals in Solidity - DEV Community
January 26, 2023 - Solidity supports both double quotation (") and single quote (') when referencing a string literal.... Tagged with java, design, softwareengineering, selenium.
🌐
Educative
educative.io › answers › how-to-perform-string-concatenation-in-solidity
How to perform string concatenation in Solidity
As a result, the new string contains all the concatenated data. The testConcatenate function takes two string inputs (first and second), concatenates them using the concatenate function from the Function library, and returns the result as the output.
🌐
Solidity
docs.soliditylang.org › en › v0.8.9 › types.html
Types — Solidity 0.8.9 documentation
The function returns a single bytes memory array that contains the contents of the arguments without padding. If you want to use string parameters or other types, you need to convert them to bytes or bytes1/…/bytes32 first. // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; contract ...
🌐
MLQ.ai
blog.mlq.ai › solidity-programming-strings-bytes-address-types
Solidity Programming: Strings, Bytes, and Address Types
December 15, 2022 - This also means if one contract ... will contain the address of the last point of contact · If we deploy this contract we see that someAdress is 0x0...initially, and if we hit updateSomeAddress it will automatically change to the last address that interacted with the contract: In this article, we discussed key data types in Solidty: strings, bytes, and ...