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)

1
vote
1answer
32 views

Convert #hashtagstylephrases to a proper list of words

I'm writing a program to split the words contained in an hashtag. For example I want to split the hashtags: #Whatthehello #goback into: ...
2
votes
2answers
31 views

Process string vector and change each string to uppercase

The question below came from C++ primer 5th edition. Read a sequence of words from cin and store the values a vector. After you’ve read all the words, process ...
4
votes
2answers
31 views

Library assistant

HackerRank currently has '7 days of JavaScript' going, a quick intro into the JavaScript language. Every day a couple of challenges will be made available. One of the challenges of today was this: ...
3
votes
6answers
496 views

Find the letter 'z' within three characters after an 'a'

It works, just feel that my solution is too complicated. ...
3
votes
1answer
32 views

Generate String with Random Consonants and Vowels

Purpose This problem comes from this dailyProgrammer subreddit challenge. The task is to take an input of C / ...
-1
votes
0answers
11 views

Forming a word parsing algorithm for a word search puzzel [on hold]

I'm working on a wordsearch program in C that takes in a grid of chars with given dimensions that parses string chucks from each row, column, and diagonal directions and compares the chuck to a ...
5
votes
1answer
123 views

Vowels in a String are in Alphabetical Order

Task Write an implementation that returns whether a String has vowels (English language) in alphabetical (A-Z) order or not. Feedback Is my ...
-3
votes
0answers
10 views

printing the alternating character in half of string [on hold]

the below code is showing runtime error on compilation. ...
4
votes
2answers
89 views

Calculating Garland Degree of String

Purpose A garland word is a word formed by chopping off the last few letters and “wrapping around” to the start. For example: You can chop off the the trailing “on” from “onion” and still ...
3
votes
3answers
64 views

Command called 'sprinkle'

I have a command called sprinkle. I'm not going to explain anything about it, because I want whoever that reviews the code to also tell me how much of the command ...
6
votes
4answers
891 views

Random string generator

I decided to make a random string generator for fun, and it works for the most part. Since I'm an amateur at programming, I thought I would post the code to get some feedback on it, and hopefully ...
1
vote
2answers
86 views

Two and a sub string

Challenge: Given two strings, A and B. Find if there is a substring that appears in both A and B. Specifications: Several test cases will be given to you in a single file. The first line ...
1
vote
1answer
63 views

Javascript startsWith prototype

I'm a Java guy in a JavaScript world, and I'm used to certain things about Java Strings that just aren't there for in JavaScript. Some of this I can accept, for example Strings are freaking everywhere ...
0
votes
1answer
34 views

Substring erase with certain pattern

For following input string: ...
2
votes
4answers
136 views

Consecutive whitespace reduction

I pursued an according algorithm with an absolute best performance, the following class embodies the solution. Any comment is welcome. ...
8
votes
4answers
949 views

Program to Check If string is Palindrome (in C) [closed]

Just wrote a program to check if a string is Palindrome. If that's true, return 1. Else, return 0. How can I improve it? ...
4
votes
2answers
74 views

Search word in multiple files

I am writing a brute-force method to search for a word. Please review my code and tell me how I can improve it. ...
4
votes
4answers
272 views

Swapping characters pairs in a string

I have to swap the characters in a string before sending said string to a device to show the information sent through a LCD, the method I developed is as follows: ...
2
votes
2answers
61 views

Counting the occurrences of a string in each file

I am trying to find a phrase or a string in file and count the number of occurrences of that string: ...
7
votes
5answers
683 views

Finding the number of vowels in a string

I'm new to Java and is trying to solve the beginners problem of finding out the number of vowels in a string. I was just wondering if there is any alternatives to any of the steps that can improve ...
3
votes
2answers
150 views

Multiple regex matches to correct OCR output

Using OCR, my program reads the current selection for each of these categories: format, invert color? and ...
4
votes
4answers
85 views

Soundex algorithm implementation in Java

Just started learning Java Strings. Tried to implement the Soundex algorithm. Package to hold the String related functions ...
4
votes
1answer
56 views

soundex implementation

The soundex algorithm maps several spellings of a name to a 4 character term. (hopefully mapping all different transcriptions to the same term) The steps as described in Introduction to information ...
1
vote
2answers
46 views

Replacing data in a .csv file

The code works well and does what I intend for it to do. In essence, it opens a file referenced as 'resource'. This is a .csv file. I then searches for the keys in the dictionary and for each key that ...
8
votes
3answers
886 views

Replace spaces with '%20'

This is my attempted solution to Question 1.3 from "Cracking the Code Interview", 6th ed. Question: Write a method to replace all spaces in a string with '%20'. You may assume that the string has ...
11
votes
9answers
878 views

Simple string inverter program

I am currently studying c programming, but I'm at a very basic level. So for practice I made a program that reads a string and inverts it. I want to know if the code is readable and how I can improve ...
-1
votes
1answer
53 views

Custom currency format

I have the following code for currency formatting ...
4
votes
1answer
42 views

strncpy To strcpy Equivalence

I have this ugly function, and I feel that the entire strncpy should just be an strcpy: ...
5
votes
3answers
431 views

Checking if string characters can be arranged to form another string

I am working on a code project that checks if all the characters in str1 can be arranged to form another string (str2). If all ...
2
votes
2answers
44 views

Count overlapping substrings

I'm looking for feedback on the actual logic of this simple Python 2.7 script. The automated grader passed it, but I expect it could be make more 'pythonic'. It was written for homework, and some of ...
4
votes
1answer
108 views

Parsing a string to extract values

I am writing some C# that will be running on Linux and will extract values from a kernel generated system file that represents readings from a sensor. The file contains two lines of text, and I have ...
11
votes
1answer
93 views

Glue Shredded Pieces (CodeEval)

I have solved problem 185 on CodeEval, Glue Shredded Pieces. The solution got a 100% score on all tests (edit: see comments), within the allotted time and memory constraints. I'm looking mostly ...
1
vote
1answer
47 views

Collating creature descriptors spread across multiple stanzas

I have been using Python for only a few days, so I am trying to learn about some best practices. An explanation of what this code is supposed to do is at the bottom of this post. It is an exercise to ...
5
votes
3answers
437 views

Write a method to determine if two strings are anagrams of each other

Is this code a good solution for the question, or is there a better way to do it? ...
5
votes
1answer
46 views

Remove duplicates from string without additional buffer

I completed an exercise from the Cracking the Coding Interview: Design an algorithm and write code to remove the duplicate characters in a string without using any additional buffer. NOTE: One or ...
8
votes
2answers
81 views

Random jagged int array generator

I've been working on learning about irregular arrays and thought making a generator such as this one would be a good exercise in applying what I have learned. The following class generates an array ...
7
votes
2answers
168 views

Removing curly braces and contents inside it

Lets say I have a string like this: string s = "A }{ B { C } }{" //Indexes: 0123456789ABCDE Just consider the indexes beyond #9 are 10,11,12,13, and 14 ...
0
votes
1answer
35 views

Replacing certain characters in a QString

This question is kinda similar to mine. However, I am using C++ with Qt instead of C#. How would I efficiently and easily remove all accents and special characters like !"§$%&/()=? etc. from a ...
3
votes
2answers
44 views

String helper class

I have class with some basic string operations. Any suggestion to improve the class ...
2
votes
1answer
60 views

Searching a string for any permutation of words

Given a string and an array of words, return all indexes in string for which a concatenation of all words in the array, in any order (so ["eensie", "weensy", "spider"] has six orderings) can be ...
1
vote
2answers
94 views

Check if a word is before another

Let's consider a method like this: public bool IsWordABeforeWordB(string Text, string WordA, string WordB) { ... } By Word ...
0
votes
0answers
32 views

Special-case sprite positioning

I have several objects which are assigned a certain size and position, works fine. The only problem is that in certain special cases the item has to be positioned a bit to the left and be a bit ...
1
vote
1answer
31 views

Print values of an array while stripping out some parts of the string

Is there a more efficient way to run this? I am especially interested in a way which perhaps does not require a for loop... ...
1
vote
1answer
74 views

String compression implementation in C

I implemented basic string compression algorithm that uses the counts of repeated characters. For example: the string aabcccccaaa would become a2b1c5a3. What do you think about this, is there a better ...
5
votes
1answer
64 views

Yet another immutable string

I know, there are a few implementations of immutable strings out there, but my focus seems to be a little different. My goal was to have a type that provided value semantics, but didn't incur the ...
5
votes
4answers
86 views

Remove specified number of characters from a string

From an exercised in Kochan's Programming in C, following a chapter on C's null-terminated strings: Write a function called removeString to remove a specified number of characters from a ...
4
votes
3answers
64 views

Replacing multiple search strings simultaneously

A utility method StringUtils.replace to replace multiple search strings simultaneously. I'm looking for a review of any and all aspects, but especially: Is ...
1
vote
1answer
61 views

Extract numbers from a string-Javascript

Consider the following string in javascript: var string="border-radius:90px 20px 30px 40px"; I want to extract the 4 numbers from that string and store them in ...
4
votes
3answers
76 views

Use va_list to format a string

I wrote a function that basically works like sprintf, but instead returns the formatted string (std::string). I haven't worked ...
3
votes
4answers
95 views

isRotation and isSubstring method

I have written an isRotation function that calls on isSubstring only once(I am allowed to call it only once). I have implemented ...