substring Questions
10
Solved
I have:
var uri = window.location.href;
That provides http://example.com/something#hash
What's the best and easiest way to get the entire path without the #hash?
uri = http://example.com/som...
Terina asked 28/4, 2011 at 12:2
6
var str = 'asd-0.testing';
var regex = /asd-(\d)\.\w+/;
str.replace(regex, 1);
That replaces the entire string str with 1. I want it to replace the matched substring instead of the whole string....
Humanly asked 30/8, 2010 at 5:20
9
I need to find the longest non-overlapping repeated substring in a String. I have the suffix tree and suffix array of the string available.
When overlapping is allowed, the answer is trivial (deep...
Crawford asked 30/9, 2012 at 3:57
3
Solved
I have a problem concerning very fast and efficient comparison between the substrings of two strings in my dataset, which won't run fast enough despite pretty powerful machinery.
I have a data.tabl...
Tyburn asked 10/10, 2023 at 9:51
27
Solved
I am trying to extract a string from within a larger string where it get everything in between a : and a ;
Current
Str = 'MyLongString:StringIWant;'
Desired Output
newStr = 'StringIWant'
Axes asked 14/2, 2013 at 4:31
27
Solved
I'm not very good with string manipulation in JavaScript, and I was wondering how you would go about shortening a string without cutting any word off. I know how to use substring, but not indexOf o...
Jameson asked 28/3, 2011 at 3:4
4
Solved
I want to extract a substring where certain pattern exist from pipe separated file, thus I used below command,
awk -F ":" '/REWARD REQ. SERVER HEADERS/{print $1, $2, $3, $4}' sample_profile.txt
...
6
Solved
In my C++ program, I have the string
string s = "/usr/file.gz";
Here, how to make the script to check for .gz extention (whatever the file name is) and split it like "/usr/file"?
1
Solved
Using SQL Server 2022, attempt to create a computed column for indexing/queries on the 3rd part of a string separated by slashes (it's a URI).
ALTER TABLE MyTable
ADD SpotName AS (CAST((SELECT Va...
Shayneshays asked 3/8, 2023 at 2:26
12
Solved
You are given a string and an array of strings. How to quickly check, if this string can be built by concatenating some of the strings in the array?
This is a theoretical question, I don't need it...
3
Solved
Instead of splitting a string, how can I regex it and extract the last substring between \ and ]?
Example:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DNS Server\anyLongStrin...
Zanthoxylum asked 27/6, 2013 at 14:27
12
Solved
right to it:
I have a words string which has two words in it, and i need to return the last word. They are seperated by a " ". How do i do this?
function test(words) {
var n = words.indexOf(" ")...
Cahoon asked 2/1, 2014 at 12:50
5
Solved
Does anyone know of an R package that solves the longest common substring problem? I am looking for something fast that could work on vectors.
Longsuffering asked 15/9, 2009 at 20:36
7
Solved
How can I strip everything in a string after the character - has occurred for the second time?
For example: Today is - Friday and tomorrow is - Saturday
I want Saturday to be removed along with the...
Corpora asked 17/6, 2011 at 0:43
4
Solved
I am looking for a grep way to obtain the characters in a string prior to the first space.
I have hacked the following function, as i could not figure out how to do it using the grep type command...
23
Solved
Let's say I have a string 'gfgfdAAA1234ZZZuijjk' and I want to extract just the '1234' part.
I only know what will be the few characters directly before AAA, and after ZZZ the part I am interested...
6
My string is "csm15+abc-indiaurban@v2". I want only "indiaurban" from my string. what I am doing right now is :
var lastindexofplusminus = input.LastIndexOfAny(new char[]{'+','-'});
var lastindex...
7
How to get all characters after the last '/' (slash) from url string?
I receive a json string from my URL scheme when making webview request for certain site. For example:
app://ga/ecommerce/%7...
Chil asked 23/3, 2016 at 10:37
30
Solved
I have a string in Bash:
string="My string"
How can I test if it contains another string?
if [ $string ?? 'foo' ]; then
echo "It's there!"
fi
Where ?? is my unknown operator....
12
Solved
How do I get the last character of a string?
public class Main {
public static void main(String[] args) {
String s = "test string";
//char lastChar = ???
}
}
10
Solved
How can I get a string after a specific substring?
For example, I want to get the string after "world" in
my_string="hello python world, I'm a beginner"
...which in this case i...
1
Solved
The following code prints 1010
#include <iostream>
#include <range/v3/algorithm/starts_with.hpp>
int main () {
using namespace std::literals;
std::cout << ranges::starts_with(&...
10
Solved
We are given a string, say, "itiswhatitis" and a substring, say, "is".
I need to find the index of 'i' when the string "is" occurs a second time in the original string.
String.indexOf("is") will r...
9
Solved
Let's say for example that I have one string, like this:
<h1>Hello World!</h1>
What Go code would be able to extract Hello World! from that string? I'm still relatively new to Go. An...
4
Solved
How can I find the position of the list of substrings from the string?
Given a string:
"The plane, bound for St Petersburg, crashed in Egypt's Sinai desert just 23 minutes after take-off from S...
© 2022 - 2025 — McMap. All rights reserved.