184,965 questions
1
vote
1
answer
131
views
Format() Entire Strings (Rather Than Characters)
Background
VBA has a Format() function which converts any value to its textual representation. This is useful for numbers and Dates and times, but it can also be used on Strings.
Debug.Print Format(&...
0
votes
1
answer
146
views
Set placeholder in a String "equals" check
I've got two lists in my Java app: The first contains commands, the second the according valid replies, which I compare to the actual replies:
private final String[] commands = {"Do something&...
0
votes
3
answers
90
views
How to slice first char from all iterable records in a string (converted from list)
I'm trying to remove the first/last two characters of each iterable record in a string (which I converted from a list and split into separate lines).
newString = "\n".join([str(item) for ...
1
vote
1
answer
155
views
String manipulation in R, conditional capture and conditional append. ?regex solution
I am using hospital data. I want to make a regex expression in R and I am struggling to do this without using string manipulation outside of a single regex expression.
The string I want to search is:
&...
3
votes
1
answer
74
views
Replace part of strings with corresponding values from table in R
I have a list of file names that encode some information as a time stamp. I would like to replace the time stamp with the appropriate corresponding information, while retaining the rest of the ...
5
votes
2
answers
85
views
unable to remove leftover "()" string with get-childItem in windows powershell
I restored a large number of files in diverse folders from a hard drive, and they all included a string.
I removed this string in windows powershell using
get-childItem -recurse | Where {$_.name -like ...
0
votes
0
answers
37
views
How do I use str::split and str::split_whitespace in the arms of a match expression in Rust [duplicate]
I have some code that splits a string and then does some processing on each part of the string, before returning Vec of values based on each segment. By default, the code should split the string by ...
2
votes
3
answers
146
views
How to properly replace long strings in Perl
Let's say I want to replace every occurrence of 12345 in file1 with the contents of file2. The following code works:
use strict;
use warnings;
local $/;
open my $fh, 'file1' or die "$!";
...
0
votes
0
answers
138
views
Does accessing the contents of the string after calling reserve causes UB? [duplicate]
From another thread I found that
indeed allocates enough storage to hold at least n elements, but it doesn't actually fill the container with any elements
If elements are already allocated why ...
1
vote
2
answers
102
views
How to extract string between delimiters [duplicate]
Let's say I have a string:
$line = "name=""abc"""
I want to extract whatever is written within the quotation marks, like this:
[regex]::Matches($line,'(?<=name="...
-2
votes
2
answers
114
views
Slice the extension `'.txt'` from file names [duplicate]
I was trying to slice the extension '.txt' from some file names.
It look like the Python cut the last letter - before the dot- if its a t or x:
filenames = ["report.txt", "downloads....
0
votes
2
answers
63
views
Need to fix string in a single block of code DATABRIcKS
I am attempting to proper case the contents of a column that has various erroneous inputs. The code I used worked on everything except where the word is all caps.
I can't do "lower(initcap(field)...
3
votes
2
answers
99
views
How to remove the apostrophe from a string in VBA
I am trying to remove the apostrophe that excel place automatically at the beginning of a string, I wrote the code here below to delete the apostrophe. The code detects the char (') but did not delete ...
11
votes
2
answers
835
views
convert string with hidden characters
I have some character strings which I'm getting from an html. Turns out, these strings have some hidden characters or controls (?).
How can I convert this string so that it only contains the visible ...
0
votes
7
answers
218
views
How to split camelCase or PascalCase strings into readable labels in Delphi?
I'm working on a Delphi mobile app and want to convert camelCase or PascalCase identifiers into space-separated, human-readable labels.
For example this is my array:
const
ReadableIdentifiers: array[...