Questions tagged [string-function]

String functions are used in computer programming languages to manipulate a string or query information about a string.

Examples are (this list is by no means exhaustive):

  • searching strings for characters or other strings;
  • extracting sub-strings or characters at a specific position;
  • replacing text within a string with some other text;
  • iterating over the characters in a string;
  • concatenating strings.

For more details, see the Wikipedia "String Functions" page.


SQL String functions

A string function is a function that takes a string value as an input regardless of the data type of the returned value. In database management systems, there are many built-in string functions that can be used by developers. As an example:

100 questions
193
votes
8 answers

Difference between IsNullOrEmpty and IsNullOrWhiteSpace in C#

What are differences between these commands in C# string text= " "; 1-string.IsNullOrEmpty(text.Trim()) 2-string.IsNullOrWhiteSpace(text)
Asieh hojatoleslami
  • 3,240
  • 7
  • 31
  • 45
7
votes
1 answer

String Function with No Paramaters Invoked with Int Should Fail Build

We have a VB.NET project which I am doing some refactoring in. A lot of current functions require a userId to be passed in as a parameter. For example: Private Function Foo(userId As Integer) As String Return "Foo" End Function But now, I have…
Jesse Webb
  • 43,135
  • 27
  • 106
  • 143
6
votes
2 answers

How to extract part of a Base64 encoded string in MySQL?

I have a field in my database which is encoded. After using from_base64 on the field it looks like this: /////2017//06//21////file.txt There may be an undetermined number of strings at the beginning of the path,…
6
votes
2 answers

How to find the character in nth position in a string

For example, create table tblvarchar ( lngvarchar character varying(500) ) And Sample Row is insert into tblvarchar (lngvarchar) values ('110010000001111101010011110000001101011000001') How to find out the character(this case (0 or 1)) in…
Vivek S.
  • 19,945
  • 7
  • 68
  • 85
3
votes
1 answer

Delete internal table lines where field contains the "+"?

I want to delete entries from an internal table, which has not a "+" in one column. Now, if I want to delete it like this: DELETE internal_table where field1 <> '+'. it doesn't work. This means, it takes the "+" as a regex and just selects any…
Sasku
  • 517
  • 7
  • 23
3
votes
1 answer

Count words of a string if they occur in a certain position within the string in R

I have a string variable tours in my dataframe df that represents the different stops an individuum did during a journey. For example: 1. home_work_leisure_home 2. home_work_shopping_work_home 3. home_work_leisure_errand_home In Transport planning…
N.F
  • 23
  • 1
3
votes
1 answer

How to remove special characters?

How to remove special characters? foreach ($login_and_logout_list['rval'] as $k => $v) { $login_time[] = $v['login_time']; $logout_time[] = $v['logout_time']; $create_time[] = $v['create_time']; $i++; } var_dump($login_time); What i am…
user8823283
3
votes
3 answers

In SQL, how to check if a string is the substring of any other string in the same table?

I have table full of strings (TEXT) and I like to get all the strings that are substrings of any other string in the same table. For example if I had these three strings in my table: WORD WORD_ID cup 0 cake 1 cupcake 2 As…
2
votes
1 answer

In MySQL 8.x the string function FROM_BASE64(str) returns result in hexadecimal form instead of a string

I have the following queries - SELECT "Abc" AS result; +--------+ | result | +--------+ | Abc | +--------+ SELECT TO_BASE64("Abc") AS result; +--------+ | result | +--------+ | QWJj | +--------+ SELECT FROM_BASE64(TO_BASE64("Abc")) AS…
Payel Senapati
  • 1,134
  • 1
  • 11
  • 27
2
votes
0 answers

Pig Latin Implementation in C

I'm trying to implement question 8.13 from C How to program, which is simply shifting left from the second char of the string and concat the first char of the string with "ay". For example: jump -> umpjay the -> hetay and so on. My try is…
akoluacik
  • 33
  • 5
2
votes
5 answers

How to remove delimited sections from text in PostgreSQL?

I want to eliminate some text pattern from a string, my string has a pipe delimiter, and the parameters do not always follow each other. This is my string TType=SEND|Status=OK|URL=min://j?_a=3&ver=1.1|day=3 I want to eliminate TType=SEND and…
Omari Victor Omosa
  • 2,814
  • 2
  • 24
  • 46
2
votes
1 answer

Can JavaScript String Function charAt() look for multiple characters?

How can I make my string.charAt() look for multiple characters at once? I'm looking to reduce the lines of code I have in my program, just wondering how I can fit multiple characters into one line. Example: normally I would…
2
votes
1 answer

String Aggregtion to create pivot columns in Big Query

I am trying to implement this exact solution linked below, but it seems GROUP_CONCAT_UNQUOTED is no longer a valid BQ function. Is there a solution to this that works in 2020? p.s. I would have just commented on the original post, but apparently my…
johnnymux
  • 55
  • 1
  • 6
2
votes
1 answer

What is the limit (in terms of bytes / number of args) to the FIELD() function in MySQL?

I'm thinking about using https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_field, but it doesn't say anything about any limits in terms of how many values it can support. Does anyone have any insight into this? Thanks!
Bob Risky
  • 805
  • 1
  • 9
  • 22
2
votes
3 answers

Can someone find the syntax error in this simple query?

Please help me with this error. SELECT StateProvince,STRING_AGG(AddressID, ',') WITHIN GROUP (ORDER BY AddressID) FROM [SalesLT].[Address] GROUP BY StateProvince; I can't find the error in this but it says Incorrect syntax near '('.
1
2 3 4 5 6 7