Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [string-processing]

Use this tag when the presented code focuses on string manipulations (such as concatenation, splitting, and extracting parts of a string) or on analyzing and manipulating the contents of strings (e.g., searching, matching against a pattern, and encoding / decoding).

Filter by
Sorted by
Tagged with
2 votes
2 answers
99 views

Checking for weak string isomorphism in Java

Intro I call two \$n\$-strings \$s\$ and \$z\$ over the alphabet \$\Sigma\$ weakly isomorphic if their character frequency multisets are equal. In other words, for an input strings \$s\$, we derive a ...
coderodde's user avatar
  • 31.9k
10 votes
3 answers
929 views

Checking for string isomorphism in C++

Intro This snippet is a translation of the Java version. Code string_util.hpp: ...
coderodde's user avatar
  • 31.9k
4 votes
1 answer
153 views

Checking for string isomorphism in Java

Intro Two \$n\$-strings \$s = \langle s_1 \ldots s_n \rangle \$ and \$z = \langle z_z \ldots z_n \rangle\$ are considered isomorphic if and only if there exists a bijection \$f\$ such that for all \$...
coderodde's user avatar
  • 31.9k
2 votes
0 answers
57 views

Funny time with DNA: a \$k\$-mer index data structure in Java, Take II

(See the previous and initial iteration.) Intro This time, I decided to pack the genomic data such that 4 nucleotide bases are encoded into a single byte. In other words, ...
coderodde's user avatar
  • 31.9k
4 votes
1 answer
102 views

Funny time with DNA: a \$k\$-mer index data structure in Java

(See the next iteration.) This time I have programmed a simple data structure called \$k\$-mer index. The actual word \$k\$-mer is a synonym of substring of length \$k\$. This data structure is built ...
coderodde's user avatar
  • 31.9k
5 votes
1 answer
336 views

Multiplying two large numbers whose digits you have in a string, in AEC compiled to WebAssembly

You can see it live here: https://flatassembler.github.io/multiplying-strings-aec.html ...
FlatAssembler's user avatar
5 votes
2 answers
99 views

Simple Word-Based Text Truncator

I created a Python 3.11 utility that truncates an input string to a fixed word count—splitting on any whitespace, collapsing runs, and dropping trailing stop-words—so you get clean, concise snippets ...
Bob's user avatar
  • 221
9 votes
2 answers
1k views

A simple C++ function converting the environment variables in main() to an unordered_map

I had this program: ...
coderodde's user avatar
  • 31.9k
5 votes
2 answers
172 views

C++ arithmetic calculator built without resorting to tree structure as conventionally done, but by parsing input string and then std::stoi

Lately I came across a book exercise that asked to implement a calculator by resorting only to std::string manipulation. I avoided C++ streams as well, as they are ...
Giogre's user avatar
  • 515
5 votes
1 answer
377 views

Converting a char string to wchar_t string based on a given toWideStr() starting point

I'm working on a legacy code base and I came across a method in which I wanted to remove the chance of swallowing an exception. In the following I want to walk you through the refacoring process, ...
Thomas Weller's user avatar
4 votes
2 answers
332 views

A View over java.lang.String - improved take II

(This post elaborates on A string view over a Java String.) This time, I have incorporated both the great answers in the previous iteration: https://codereview.stackexchange.com/a/293506/58360 by ...
coderodde's user avatar
  • 31.9k
5 votes
2 answers
577 views

A View over java.lang.String

(This post has continuation at A string view over a Java String - improved take II.) This time, I have a simple string view class for faster operation on substrings in actual string objects: ...
coderodde's user avatar
  • 31.9k
3 votes
2 answers
330 views

Truncating/abbreviating strings in the middle with an ellipsis (…) (or other) separators with a fixed character limit

Problem For some user-facing string, I want to truncate it to some given maximum length (also useful for file name/path lengths on Windows etc.). However, I want to do it a little more elaborately ...
rklec's user avatar
  • 163
4 votes
2 answers
497 views

Z-Function/ Algorithms on strings. C++

The problem: Given a string s. For each i from 1 to |s|, find the number of occurrences of its prefix of length i in the string. Input: The first line of input contains an integer q (1≤q≤10⁵) — the ...
neely's user avatar
  • 43
0 votes
2 answers
150 views

Advent of Code 2023 - Day 19: Aplenty (Part 1)

Description: The task involves processing a set of workflows, each comprising rules. These rules define conditions based on part ratings and dictate the destination workflow if the conditions are ...
Madagascar's user avatar
  • 10.1k

15 30 50 per page
Morty Proxy This is a proxified and sanitized view of the page, visit original site.