A string is a sequence of characters. It is commonly used to represent text or a sequence of bytes. Use this tag along with the appropriate programming language being used.

learn more… | top users | synonyms (1)

2
votes
1answer
37 views

Removing accents from certain characters

I have a method that I am using to remove accents from certain characters. The problem is the massive slew of characters I am expected to work with. I have to, basically, remove accents from all Latin ...
6
votes
2answers
189 views

Printing the number in large size

Problem Description Receive a 5 digit number and print out in a large size. Sample input 32145 Sample output ...
4
votes
2answers
133 views

Finding the first non-repeating character in a string

Below is a problem I encountered during an online course. There are a lot of similar questions asked on this, but I couldn't find a solution there as well as I believe my specific issue is a bit ...
7
votes
3answers
371 views

Search string for a substring - indexOf

I am trying to write my own implementation of indexOf for learning purposes. I have an implementation of as follows. I'm sure a more efficient and shorter ...
4
votes
8answers
484 views

String reversal, capitalize vowels, lowercase consonants

This was a portion of a skills test given to me by a company. The task was to write a method that takes a string, reverses it, and sets the vowels as capitals and consonants to lowercase. I was also ...
2
votes
2answers
298 views

Return the first word in the image name

I just want to return the first word in the image name (before the dash, dog in my example). Now I use it like this but believe it can be done in a simpler way ...
4
votes
1answer
47 views

Parsing a string to an object

I have this string containing this block of code: ...
5
votes
1answer
63 views

Rearranging array - with empty strings in front and non-empty strings at back

Given a string array that either contains empty strings or non-empty strings, arrange the contents such that all the empty strings are at front and non-empty strings at back, retaining their ...
6
votes
1answer
59 views
+50

Korean Romanization to Hangeul library

After a little work, I've finally ironed this out... Though could I get someone to go over this and see if there is a better way to present this library within the code, before I publish it? Premise: ...
8
votes
2answers
125 views

Text Analyzer - Properly implementing Java coding style

As a new Java learner I would like to improve my coding style. I wrote a program which gets as an input a file name, and asks for two file names for the output. The first output file includes all the ...
4
votes
2answers
206 views

Return all words which have their reverse present in a string

Problem Statement: Given a string of words return all words which have their reverse present in the string as ( (word1 , reverseword1 ) , (word2 ,reverseword2) ) Example Case: Input: ...
2
votes
1answer
37 views

Simple string-root detection in a string-family

(this problem is related to Simple string-split by root and sufix algorithm ) There are many ways to find a "common root" of a list of similar strings, that begins with the same substring... The ...
3
votes
1answer
64 views

Simple string-split by root and sufix algorithm

A classic problem to split a string into its "root and suffix": (Stemming) The word "walk" is the base form for word "walking" (suffix is "ing"); The file path ...
3
votes
1answer
44 views

Rename subkeys of nested dictionary dynamically

My nested (ordered) dictionary looks like this: ...
3
votes
3answers
119 views

Reversing strings using recursion

I'm trying to solve exercises where I am required to use recursion. I wrote this: ...
4
votes
3answers
116 views

First non-repeated character

Challenge description is here need to find the first non repeated character from the string: Write a program which finds the first non-repeated character in a string. Input sample: The ...
4
votes
3answers
114 views

Phone List challenge

To learn Haskell, I've been going at this challenge, which is to check a list of phone numbers to ensure that no number is a prefix of another. However, my code is way too slow. I am really new to ...
4
votes
3answers
63 views

`std::vector` 'substring concatenator'

The point of this is to concatenate a vector of std::strings into one string starting at an index of the vector. ...
2
votes
3answers
55 views

Searching a string of consecutive characters in a binary bar code

I am writing a program that will take a binary bar code and convert it to a zip-code. I need to validate the bar code. A valid binary bar code contains no more and no less than two 1s in any position ...
6
votes
3answers
270 views

Article start exercise

I've used encountered this exercise from a tutorial: Create a function that takes a string as a parameter and returns True if the initial word of the string ...
3
votes
5answers
243 views

Checking if all the characters from an A-Z is present in the string

A string is said to be complete if it contains all the characters from a to z. Given a string, check if it complete or not. Input First line of the input ...
5
votes
3answers
148 views

Replacing all occurrences in a String

I have a string like this : val content = "some_text{macro1}another_text{macro2}text" I want to replace the {macro1} and ...
8
votes
3answers
393 views

Constructing a query string using StringBuilder

I speedily wrote a bunch of crappy checks, to check whether strings are empty, in order to build a query string. ...
3
votes
3answers
99 views

Build a dictionary based on split string

I've written a simple script that takes a string filled with brackets and strings and builds them to a dictionary. Example Input: ...
5
votes
1answer
75 views

Constructing Unique String Sequence

I am brushing up on my Java skills by trying to solve the below assignment problem I found on the internet: Write a Java method that accepts two strings as parameters and returns a string that ...
4
votes
1answer
49 views

Create Java object from from page content or plain text

My job is to make a specified java objects from web page that contains following text: Companies: ...
-2
votes
2answers
61 views
5
votes
2answers
245 views

Longest substring with unique characters

Find the length of the longest substring without repeating characters Any comments on my code? ...
5
votes
3answers
1k views

C++ Pig Latin program

I'm just wanting some input on to how others would approach this problem. I am learning and wish to gain insight on others techniques. Be as critical as you need. I want to learn. I feel this code is ...
6
votes
1answer
104 views

Simple syntax highlighter in Javascript - SQL highlighting

Yesterday and today I've made a very basic syntax highlight. It creates a function in the window object that handles part of the job: ...
6
votes
2answers
282 views

Next revision letter

This is a fun one! I wrote some code to automatically get the next revision letter for a file by looking at the existing letter. It works, but I think there is room for improvement as far as ...
2
votes
1answer
45 views

Taking advantage of the falsey and ineffective “” empty string

The following code snippets are academic. I was required to make a PHP generated HTML interface for a MySQL database of a movie rental store, and the requirement was filtering the displayed movies by ...
2
votes
1answer
83 views

Count balanced substring

Chandan got bored playing with the arrays all the time. Therefore he has decided to buy a string \$S\$ consists of \$N\$ lower case letters. Once he purchased the string, He starts formulating his own ...
3
votes
2answers
80 views

Extracting a sentence containing a specific word from a longer text

My goal is to return a specific sentence in a story that contains a given word. Returns null if the word is not in the story. I'm ok with returning the first ...
1
vote
2answers
41 views

Neatly printing integers interspersed with spaces - follow-up

See the previous iteration. At this point, I have "digit group" length assumed to be always 3 the user can pass the delimiter character of his/her own handles (seems to handle) the minus sign ...
1
vote
1answer
21 views

Neatly printing integers interspersed with spaces

The next iteration is here. I have this small method for printing long integers neatly. For example: ...
5
votes
4answers
339 views

Word Guessing Game

I'm trying to learn Java (albeit rather slowly). I'm in a computer science class at my highschool and I've written this little bit of code for a project. Basically it is a word guessing game where if ...
6
votes
3answers
183 views

Expanding a string to a certain length

I wrote a function for repeating a string to a certain length. For example: ExpandString("Test", 11); // output: "TestTestTes" Are there any optimizations ...
3
votes
2answers
69 views

Phone keypad implementation

I was wondering, beyond the standard improvements that this needs, is there a more "clever" way of solving this problem? The problem is to translate letters into digits without changing the format of ...
4
votes
1answer
73 views

Boolean expressions from infix to postfix notation using Dijkstra's Shunting Yard algorithm

I began working on a Java library that receives a boolean expression such as not A and (B or not C), compiles it to a circuit of logical gates \$\mathcal{C}\$, ...
3
votes
1answer
55 views

Create a list of all strings within hamming distance of a reference string with a given alphabet

For a bioinformatic problem, I found myself wanting to create a list of strings within Hamming distance "k" of a reference sequence. I wanted to do so quickly and pythonically. I've implemented it in ...
7
votes
1answer
696 views

A little integer parser vs clean code

I was said to post this as a new question. I improved my code from: Little part of the string to integer parser vs Clean Code However I think that it break SRP as it parses, iterates through string ...
3
votes
2answers
41 views

String trim functions with destination size limitation

3 string trimming functions: Trim whitespace from the beginning of a string. Trim whitespace from the end of a string. Trim whitespace from both ends of a string. Looking to improve code ...
4
votes
3answers
154 views

Little part of the string to integer parser vs Clean Code

I started reading a Clean Code book and some other articles on the Internet about OOD and design patterns and I'm a little confused. I've started to code a little string to integer parser which ...
4
votes
3answers
89 views

Console app to compare all directory names for similarity

I just got the urge to write a small console app to compare all directories name for similarity. I have > 3000 directories and over time some of them are really similar, eg. an update: Test Case ver 1 ...
5
votes
2answers
93 views

Getting a substring of a delimited string

I have some underscore-delimited strings like abc_def_ghi. I would like to get a substring out of the string made of one or more delimited substrings, so that if I ...
1
vote
3answers
87 views

Checking whether two strings are isomorphic

I was trying to solve a problem to determine if 2 strings are isomorphic. They are isomorphic when each character in string one can be replaced with another character in string 2. Two different ...
-2
votes
1answer
38 views

Text-to-Morse Code translator [closed]

I'm curious if anyone can come up with a better code structure (loops, checks) than what I have done. I need to change the structure because my teacher was unhappy with the for loop and if else's for ...
2
votes
3answers
66 views

Join 5 optional strings with a joiner character

I need to append some query parameters to my API URL. The consumer of my API would pass me this optional structure called as APIParameters, which contain 5 optionals, one array of strings and rest ...
10
votes
1answer
133 views

Injecting the Maharajah into the Barbarous Child's introduction

I'm building a random text generator! My idea was to borrow slightly from the string.Format method styling, have a "format string" that controlled the overall ...