Questions tagged [strings]

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.

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

String Mutator performance

I've made a very basic wrapper over a String that offers mutability in place (context: mono/XNA, budget is about 11ms per frame, 0B (ZERO, NIL, НОЛЬ, NADA) allocations hard requirement). Before that I'...
9
votes
4answers
925 views

StringTokenizer for .NET Core

Splitting a string in tokens is a more complex topic than String.Split() wants to make us believe. There are at least three common policies according to which a string might be interpreted and split ...
2
votes
1answer
65 views

Converting an integer to a hexadecimal string representation in Java

I have rolled my own Java method for converting ints to the hexadecimal Strings: ...
6
votes
2answers
107 views

Hide certain email characters

Hide email characters: When email only has one letter then just cover that letter with the * symbol e.g. *@gmail.com When ...
4
votes
3answers
466 views

String class implementation

I'm working on a project (it's a language), and for that project, I decided to go with a low-level C++ style, so that means making my own data types. I recently got done making my own string class ...
3
votes
0answers
64 views

Early Stages of floating point class template in C++

I'm currently designing a class template to represent scientific notation or a floating-point number system. There are currently 4 distinct types: BIN, ...
5
votes
4answers
348 views

C#: Repeated String

From HackerRank "Repeated String" challenge: Lilah has a string, \$s\$, of lowercase English letters that she repeated infinitely many times. Given an integer, \$n\$, find and print the ...
5
votes
1answer
98 views

Similarity between words

I'm writing a method that writes the code for a loading routine. Given an object from the database, I want to put its properties in the right control on a userform. I have the list of the properties ...
6
votes
2answers
85 views

My first C# project - Simple bird of prey identification console app. Does it need refactoring or complete rewriting?

this was my first thing i made on my own without any help. im sure theres a lot of improvement that could be made, i dont feel too confident about this. how can i make it shorter and more efficient? ...
4
votes
1answer
91 views

LeetCode: Find And Replace in String C#

It took me a while to solve this question and there are corner cases i missed hence the 4 unit tests. please review for performance. and if you can treat this as a review for a 45 mins programming ...
1
vote
0answers
35 views

Custom include? method for a substring

Task: Write a function which returns true if a given substring is found within a given string. If the substring isn't found, then return false. My implementation: ...
6
votes
1answer
81 views

Reverse character order of substrings delineated by white space chars

The Challenge: Given a string, return a string where each word is reversed individually without changing its position. EDIT: (i.e.: the input "hello world I am a frog?" should produce the ...
2
votes
1answer
140 views

Add comma/and between string array in java

i get an array of authors from json response and i have to display authors name in TextView(android) in proper format like =>Viraj, Chetan and George R. R. Martin my code work fine, but it's a mess....
7
votes
1answer
655 views

JavaScript string to Unicode (Hex)

This set of questions are related to a project I've published for converting characters, or strings, to Hex based Unicode; eg... ...
6
votes
2answers
888 views

Python - use a list of names to find exact match in pandas column containing emails

I have an Excel file containing a free-form text column (that sometimes is structured like an email), where I need to find all first and last names and add an extra columns saying TRUE/FALSE to these ...
1
vote
1answer
90 views

Getting 6000+ substrings from large a large string

I have a class that opens a text file and reads out its content. This class has a member function that will extract a substring between two given delimiters. My application needs to extract between ...
3
votes
2answers
211 views

Random alphanumeric string generator function (C, Windows, bcrypt.h)

The function uses the Windows "Cryptography API: Next Generation" (bcrypt.h)'s BCryptGenRandom function to generate ...
4
votes
2answers
171 views

Checking if a string contains all unique characters

I am currently reviewing CTCI(Cracking the Coding Interview) The question is asking me to implement an algorithm which checks whether the characters in a string are all unique however they do not want ...
4
votes
2answers
61 views

Format string processing similar to date or printf()

I wrote a function that is supposed to take a format string similar to what date accepts and replace all format specifiers with strings provided by a callback ...
-3
votes
1answer
39 views

I am trying to save a string to a MYSQL table from a radiobutton in java/Android studio [closed]

I am trying to save a radiobutton string if it clicked. I am making a survey where I need to save a "yes" or "no" into a MYSQL table using volley. I am having a little trouble ...
12
votes
2answers
491 views

C# - name separation & last name in upper to Camel

I had an xls file with lots of full names in the following form at work: ...
3
votes
1answer
77 views

Simple Password Generator Feedback

This is my first major project in F#, looking for any critique on how I can make it more standard or more concise. Some things I feel like I could have done better are the command flag parsing and the ...
3
votes
3answers
116 views

Optimize Memory Java String Array

I was trying to solve one programming challenge : First input is a list of connections which is made of pair of IPv4 address. Each IP has its own state which starts with false, each connection also ...
1
vote
1answer
297 views

Filtering a Vec of structs and creating new vector of Strings or strs in Rust

I'm working through the Rust book, and it has the following example of how to use the filter method on Iterators (source): ...
2
votes
2answers
126 views

Exercism: determine if a word or phrase is an isogram

The task: Determine if a word or phrase is an isogram. An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed ...
3
votes
2answers
84 views

Code to modify string as per instructions

I solved this problem statement on dear old codeforces. The Problem Statement wants users to replace occurrences of '10' in the given string with either '1' or '0' until there is no occurrence of '10' ...
6
votes
1answer
69 views

Custom cross-platform extended ASCII converter

Problem/Background: I want to support only some special Unicode characters for my program (Greek letters and some math operators). C++ provides a char type, which ...
8
votes
4answers
2k views

JavaScript function that flips brackets direction

I have these strings: )hello( this has ]some text[ flip }any{ brackets even with )))]multiple[((( brackets As you can see, the brackets are all in the wrong ...
2
votes
1answer
112 views

Trie implementation for strings in Swift

A trie for handling strings for an autocomplete dictionary. This passes my fairly casual tests, though it's always possible that there are broken edge cases, but I'm mainly concerned about design and ...
4
votes
1answer
135 views

Hamming distance implementation in Java

I'm exploring String relativity and comparison techniques, and I found Hamming distance algorithm in my search so I give a try to implement that approach in Java and below I'm sharing my ...
6
votes
3answers
372 views

C: function to read a token from stdin

I recently started doing some competitive programming in C and one of my first requirements was a high-speed token reader (analogous to the java Scanner class' <...
2
votes
1answer
78 views

Implementation of itoa

...
7
votes
2answers
87 views

Pretty-print dollar amounts using custom precision for large amounts

Given a floating-point number, which is representing a dollar value, I'm aiming to return a rounded, human-readable string. Here are the rules for numbers equal to or greater than 1 million, equal to ...
1
vote
1answer
43 views

Encasing a string in double quotes

I need to add some characters to a String before using it for an API call. The idea is to add a " char both at the beginning and at the end of the String, to make ...
3
votes
2answers
54 views

Smartly joining possibly empty strings

I want to join two fragments into one string with a separator, but when one of the fragments is empty I only want one of them. I have two implementations. The first is long and slightly repetitive, ...
2
votes
0answers
34 views

SHA-256 implementation in JS (core codes)

As told by experts, I am re-posting the code review request with the code. Brief Description: from outside sha256() will be called with parameter having UTF-16 character set. then after prepareData()...
3
votes
1answer
76 views

Listing words from text, provide lines where appears, count them

I applied for Junior Java Developer in some company. Got a task:"Listing words (without duplicates) from text, provide lines where appears, count them." Output should looks like: Alphacoronavirus - 3 ...
-2
votes
1answer
75 views

Sorting through two dictionaries [closed]

What my code try to do here is to sort items trough 2 dictionaries. If they are similar or the same, I create a new list to append them. The test file is relatively big, around 2000 data each ...
2
votes
3answers
75 views

Perl - Splitting a string

I've decided to work on my Perl skills. I've written a small subroutine that splits a string based on an optional delimiter. I'd like any feedback on this program so I can kick bad habits to the curb. ...
1
vote
2answers
149 views

Protein Translation - Translate RNA sequences into proteins

RNA can be broken into three nucleotide sequences called codons, and then translated to a polypeptide like so: RNA: "AUGUUUUCU" => translates to Codons: <...
1
vote
0answers
186 views

Own implementation of C++ std::string_view

In order to improve my C++ skills I started doing some toy projects, one of them being my own std::string_view implementation. This was my first time implementing a std library. I'm pasting the code ...
9
votes
3answers
951 views

Roast my C# birthday code

So this is a pretty simple code, I think it was? It asks for the user's birth day and month, and gives it back with the day a discount reminder email will be sent (the day before their birthday) Now ...
5
votes
3answers
85 views

Add two digit strings and return the result as string

I haven't done C in a while. This looks like a simple problem to start. Leetcode problem 415 Given two non-negative integers num1 and ...
3
votes
1answer
151 views

Amending code to make it list some files in a directory, rather than all

The method list_all() is the code I am starting with. It just lists all files in "c:\windows". I want to adjust it to list only the first 10 files (if there are as ...
2
votes
1answer
65 views

Code for adding a user to the database

I have a code that adds a user to the database, getting the username from the dialog.My fragment implements the interface with the onInputSend method, which is called by the dialog when the user ...
0
votes
2answers
348 views

Sherlock and Anagrams in Javascript

I am trying to solve a Hackerrank problem Sherlock and Anagrams. I think my code is valid but somehow times out for some of the test cases. Any tips on how to improve its performance? Critique ...
5
votes
5answers
1k views

Convert Integer to String without using Java API library

I have written a Java program that converts an integer to String digit by digit and concatenate them together using the + operator without touching the Stock Java API library. I like to have feedback ...
2
votes
1answer
59 views

Receive an array input and output a string

I have some code which is working, but I would be interested if anyone could review it and tell me if there is a more efficient way of achieving my goal. I receive input from a data source as an ...
-3
votes
1answer
22 views

How to convert Recursive Approach to iterative one(Super Reduced String)? [closed]

The Question: Steve has a string of lowercase characters in range ascii[‘a’..’z’]. He wants to reduce the string to its shortest length by doing a series of operations. In each operation he selects a ...
5
votes
2answers
386 views

Dynamic String Alignment Code

My code works for user output alignment to the right side by maximum length of 4 different user input. I have 2 question. Is there a simplier way for append method in my code ? Is there a simplier ...

1
2
3 4 5
54