Skip to main content

New answers tagged

Advice
2 votes
0 replies
0 views

Input: "ab1000cd25000ef30" Output: [10, 25, 30]

What have you tried? What specifically do you need help with?
Carcigenicate's user avatar
0 votes

Does String.ToLower() always allocate memory?

Tangentially related, but RegEx.Replace() has a similar behavior. You get a new string object even if it's unchanged from the original. Take the common case of whitespace normalization. You want ...
user1664043's user avatar
0 votes

Create a String from each line, adding quote marks, from text file, In Java

Modern Java We can make simple work of this by using the features of Modern Java: NIO.2, streams, lambdas, and IO class. Path.of identifies the file to read, in Java 11+. Files.readAllLines in Java 8+ ...
Basil Bourque's user avatar
2 votes
Accepted

VBA/Regex replace characters with groups using pattern

I fixed your macro, try it Your regex was perfect! You just needed to add cell.NumberFormat = "@" before assigning the new value. Without it, Excel reconverts "7:30AM" back to time ...
Polis Linus's user avatar
0 votes

How to check that a string is an int, but not a double, etc.?

Another option is to check if a cast is reversible. function is_int_like(string $value): bool { return (string) (int) $value === $value; } or, if the value could be int|string: function is_int_like(...
donquixote's user avatar
  • 5,700
-1 votes

Convert list of objects to string in one line

Here is the shorter version I've ever used: var result = string.Join(",", [.. objestsList.Select(x => x.stringValue)]);
Single Step Debugger's user avatar
Advice
0 votes
0 replies
0 views

Best SQL Function for Text Filtering

This really depends. If this is just about soccer, because you always want to quickly find all soccer content, then a function index might already be the perfect solution. As this is about people's ...
Thorsten Kettner's user avatar
Advice
0 votes
0 replies
0 views

Best SQL Function for Text Filtering

Like others say, you can use LIKE on your column, but CONTAINS_SUBSTR is a better choice because this function is optimized for performance when working with large datasets. Remember that this ...
Amandine's user avatar
Advice
0 votes
0 replies
0 views

Best SQL Function for Text Filtering

Many databases support "full text search" beyond the LIKE operator. For example postgress
JonSG's user avatar
  • 13.6k
Advice
0 votes
0 replies
0 views

Best SQL Function for Text Filtering

You really need to show us the structure of your dataset and some sample data in order for us to accurately assist you.
Dale K's user avatar
  • 28.4k
Advice
0 votes
0 replies
0 views

Best SQL Function for Text Filtering

The best and simplest way to filter rows containing a specific word like "soccer" in SQL is to use the LIKE function. Example: SELECT * FROM your_table WHERE column_name LIKE '%soccer%'; ...
Fazil's user avatar
  • 1
2 votes
Accepted

Getting weird results from java string codepoints on a windows machine

Those ? are replacement characters. When encoding, replacement characters are used for characters not supported by the charset. When decoding, replacement characters are used for byte subsequences the ...
Slaw's user avatar
  • 51.2k
2 votes

How do I check whether a string is zero-length in Meson?

This can be achieved by comparing the string to an empty string, e.g.: if get_option('example') != '' # do something if example isn't set to an empty string endif
Newbyte's user avatar
  • 4,079
Advice
0 votes
0 replies
0 views

How to find a substring within a string in C?

Typically you would use strstr (or strcasestr if you want to ignore case).
Tom Karzes's user avatar
  • 24.3k
Advice
1 vote
0 replies
0 views

How to find a substring within a string in C?

Just kidding! Don't use this approach!! POSIX regex FTW #include <regex.h> #include <stdio.h> #indlude <stdlib.h> #define HAYSTACK "C is a programming language" #define ...
pmg's user avatar
  • 110k
Advice
2 votes
0 replies
0 views

How to find a substring within a string in C?

I don't know which browser or search engine you are using, but if i do a search using the term How to find a substring within a string in C? i receive the following AI response (in my browser with ...
Erdal Küçük's user avatar
Advice
0 votes
0 replies
0 views

How to find a substring within a string in C?

Don't forget to look at Check substring exists in a string in C and the many other variants of that question on StackOverflow. You have two main choices. Either use the string.h functions like strstr()...
David C. Rankin's user avatar
Advice
0 votes
0 replies
0 views

How to find a substring within a string in C?

Thank you! This is very helpful for understanding how to do it without using libraries
EmiliSpotato's user avatar
Advice
0 votes
0 replies
0 views

How to find a substring within a string in C?

Thank you! This is exactly what i needed!
EmiliSpotato's user avatar
Advice
3 votes
0 replies
0 views

How to find a substring within a string in C?

The C function strstr() (from <string.h>) is exactly for that: char* strstr( const char* str, const char* substr ); Finds the first occurrence of the null-terminated byte string pointed to by ...
wohlstad's user avatar
  • 37.6k
Advice
0 votes
0 replies
0 views

How to find a substring within a string in C?

Find l (:the 1st char of word[]) in string[]. If found, then check if the next character in string[] equals a (:the 2nd char of word[]). If equals, then ...
fana's user avatar
  • 1,859
Best practices
0 votes
0 replies
0 views

Unescape string to get special character from user input

The shell (I assume Linux) interprets \n as just n. In order to pass in the actual newline, you have to escape it: python -m service.run --separator $'\n'
Hai Vu's user avatar
  • 41.6k
0 votes

how to return a specific value if a substring (i.e., a word) is found in a cell which contains text in EXCEL

Using 365, with regular expression the below formula returns the corresponding values you need. It eliminates substrings where a word contains a searched value and some other characters e.g. Nickels ...
Black cat's user avatar
  • 7,710
0 votes

Converting a byte to a binary string in C#

I'm not sure if this is a recent change, but in 2026 -- rather than padding with zeroes -- you can use a formatting string passed to byte.ToString(), e.g. var someByteValue = (byte)255; Console.Write(...
user31820005's user avatar
0 votes

Regular expressions loop code, how Backtracking works?

If I understand you correctly then you're just missing an additional try-catch and the maxreps >= 0 or throw Backtracking; before the next loop; otherwise you have an infinite loop, also you are ...
MAZ's user avatar
  • 121
0 votes

Remove spaces from std::string in C++

std::erase_if since C++20 #include <cctype> #include <cstdio> #include <algorithm> #include <string> int main () { std::string s{" Here Is Some Text With Spaces "...
Petr Vepřek's user avatar
  • 1,658
1 vote

Toggle between two strings

To toggle between two strings, use ternary operator. String other = value.equals("good") ? "bad" : "good"; // Toggles between two strings.
Marcelo Carvalho's user avatar
0 votes

Join strings with different last delimiter

Yes, this is a common requirement (often called joining with a different last delimiter). The standard Collectors.joining(", ") does not support this directly, but you can handle it cleanly ...
Amresh Yadav's user avatar
0 votes

Join strings with different last delimiter

As noted by @NarutoUzumaki in this answer, JDK 22 provides ListFormat which does this for lists with and/or in a locale-sensitive way (with or without the oxford comma). In JDK SE 22 we have a ...
Joshua Goldberg's user avatar
0 votes

Find row with longest string in R

Here is a dplyr option: library(dplyr) DF %>% filter(nchar(V1) == max(nchar(V1)))
Quinten's user avatar
  • 43.1k
1 vote

How can I check if 2 columns have similar text in pyspark?

You can use probabilistic record linkage to find similarities between words, which will help link table columns. Also, if you are using Databricks, you can use Databricks ARC. This will find and link ...
Nikhil M.'s user avatar
2 votes

How can I generate random strings consisting of eight hex digits?

There's also the String::Random, which provides various ways to create strings passed on patterns, structure, or something else you might define: use String::Random; use v5.10; use String::Random qw(...
brian d foy's user avatar
1 vote

How can I generate random strings consisting of eight hex digits?

my $rand_hex = join '', map {[0..9,A..F]->[rand 16]} 1..8; This will generate a string, not just a sequential print (as the method shown above). I'm not a grand master in Perl but for me this is ...
Reflective's user avatar
  • 3,943

Top 50 recent answers are included