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
1
vote
1answer
56 views

get address parts based on requested parts

I have different format of address in an array, those format looks like this ...
-2
votes
1answer
134 views

Fastest string search algorithm invented by me. It is called ""Choudhary String Search Algorithm""

I have invented the fastest string search algorithm. It is called ""Choudhary String Search Algorithm (choudharyStringSearchAlgorithm)"". I have compared my algorithm with Brute ...
4
votes
3answers
298 views

Functions in C language that manipulate strings, not present in the standard C library

I have implemented few functions in C language that manipulate strings. These functions are not present in the standard C library. string_library.c ...
3
votes
2answers
421 views

Simple string manipulation in C (for small microcontrollers)

Although I have long experience of other languages, I've not used C until playing around with microcontrollers using the Arduino IDE. I'm a bit uncomfortable with my use of pointers in conjunction ...
2
votes
2answers
63 views

Function to find substring in a list of strings and add them to the resulting list

I am trying to look for a substring in a list of strings. My end result is an array that contains the presence of substring first based on course.name and then ...
3
votes
2answers
52 views

User-friendly string struct and utility function - upated version

Updated previously posted string struct and utility functions Previous link: User-friendly string struct and utility functions What is updated ? typedef of sstring is a major update. previously, ...
1
vote
2answers
29 views

Function to remove set of trailing characters from string

I needed the ability to truncate the trailing end of path strings in a routine that builds new search paths as it recursively searches directories. After not finding what I was looking for I created ...
3
votes
2answers
163 views

string increment

Last night I was practicing incrementing strings. What it needs to do is increment the last character if it is a digit or letter. Special characters are ignored. The code that I have written does the ...
7
votes
2answers
1k views

Assign determisitic Orcish names for debugging

Orcish Large volumes of unlabelled data are hard to visualize when debugging; I find it difficult to keep track of the pointers in memory. I have used this code to assign Orcish names, (it's a name ...
2
votes
5answers
139 views

Substring extension method with a method of removal

I consistently have code where I need to pull individual chunks of substrings out of a larger string; while I won't get into details, it's easy to replicate in a proof of concept: ...
2
votes
1answer
61 views

The Rust Programming Language Pig Latin

This is my implementation of the Pig Latin recommended exercise in The Rust Programming Language book. Any pointers on making this code more idiomatic or run more optimal? ...
2
votes
2answers
188 views

User-friendly string struct and utility functions

Created a new typedef and functions supporting it, making it user-friendly [specifically programmer-friendly]. What does the code do? It makes users [programmers] easy to deal with strings as most ...
4
votes
1answer
137 views

String Manipulation: Given two operations on a character 'A', Copy and Paste, find the minimum number of operations to produce a string of length 'N'

I have a solution to the following question which seems straightforward enough. However, I feel as if I am missing something. The question: Objective: You have given a character ‘A’ which is already ...
3
votes
3answers
93 views

Convert program arguments to std::wstring

Due to recent need I wrote a simple main function that has the goal to convert the C-style strings and arrays into a more STL-style. Then because I also had a need ...
2
votes
3answers
112 views

Convert string to integer and catch errors

I have attempted [and made one] function to convert string to integer and catch errors in pure c Working method The whole working method is present in code itself The header file The str2num.h here:- <...
2
votes
1answer
67 views

replace substrings from within Hebrew text

I have a string of Hebrew text which also contains":", "-", & "|". Attempting to replace "-", "|", and ":" with a space. How can I do ...
2
votes
1answer
41 views

word frequency distribution

wordList is an array of non-empty strings ("words"). The following code I have written with the purpose of obtaining a Map, containing the unique words ...
15
votes
5answers
2k views

Comma Code, Project from "Automate the Boring Stuff with Python"

I'm a newbie. I'm at Chapter 4 of Automate the Boring Stuff with Python. Comma Code Say you have a list value like this: ...
2
votes
2answers
54 views

Find the 'n' most frequent words in a text, aka word frequency

I'm doing freeCodeCamp's Coding Interview Prep to improve my JavaScript skills. This challenge is called "Word Frequency", and is based on the Rosetta Code's entry of the same name. The ...
5
votes
3answers
1k views

FizzBuzz, but with provided start and end of sequence, results stored in array, and a separate function to convert integers to strings

To learn C, I'm doing the traditional FizzBuzz challenge with extra restrictions: The start and end of sequence is provided by the user Instead of directly printing the results, the results must be ...
1
vote
1answer
58 views

Finding longest palindromic substring in a string (gives TLE on leetcode)

I'm solving the Longest Palindromic Substring problem on LeetCode. And here's my final submission: ...
2
votes
3answers
67 views

Phrase to acronym in C from exercism.io

I am learning C and doing challenges like those found on exercism.io and the various data structure & algorithm sites. I have a sense that while this works and it makes sense to me that it can be ...
6
votes
2answers
152 views

A string separator that doesn't separate if in quotes

The sep function separates string by the characters of seps, but it escapes the separates ...
0
votes
0answers
28 views

Batch installing packages script in Octave

I am attempting to write a light script to deal with multiple package installation in Octave. The available packages can be checked in Octave Forge or wikipedia. For example, if the packages ...
2
votes
2answers
89 views

Algorithmic Efficiency: GetShortestUniqueSubstring implementation

I came upon this Youtube video and the problem they discussed piqued my interest, so I decided to take a stab at it. Below is the question: Given an array of unique characters ...
2
votes
0answers
27 views

zsh function for shrinking $PWD with $HOME replacement

I wanted a $PWD shrinking for my $PROMPT with the following requirements: $HOME is replaced ...
1
vote
2answers
85 views

Is there a way to simplify getting the character that appears the most in a collection with Linq?

I have a collection of strings, all of which are three characters in length: ...
1
vote
1answer
28 views

Convert string to object array javascript

I want to convert string to object array. Suppose I have following string. const str = "someValue,display"; I want to convert it like following. ...
2
votes
1answer
73 views

Grouping anagrams together from a string array

I wrote this code in c#. It is a question from LeetCode, number 49. Given an array of strings, group the anagrams. The examples it gives are: ["eat","tea","tan","...
1
vote
3answers
61 views

Word frequency finder

Challenge: find the top three most frequently used words in a string. Only imports from the base package are allowed (source: codewars) I'm looking for feedback on (...
-1
votes
1answer
62 views

Better way to format a query string in Java

description I'm using influxDB, I need use Java to generate a query command. The TestingTag struct maybe missing 0-3 fields. code: ...
1
vote
1answer
59 views

Improving poor man's translations mechanism in c++98 program (follow-up)

As a follow-up to this question that was an attempt to add basic translation capabilities in an old c++98 program for the sake of the community, I'm posting here the first iteration of my code after ...
2
votes
3answers
82 views

Batch extracting differences between two images with enhancement using opencv

I am attempting to extract the absolute differences image between two input images and then enhance the intensity (brightness) channel in HSV color space with the given times. The workflow is like ...
0
votes
1answer
108 views

Improving poor man's translations mechanism in c++98 program

In order to add basic translation capabilities in an old c++98 program I've come up to a basic and shameless code summarized by this snippet: ...
1
vote
2answers
157 views

Parsing words from string

I am learning Java, so I am beginner. I know I can do this with split function but I want to improve my algorithm knowledge. I will be glad if you help me. Thanks. inputStr variable is contains the ...
1
vote
1answer
76 views

Replacing a char in the file name

I am formatting my TV series archive and can not do one by one. I wrote this code and it's working like what I want. I am a beginner and want to improve my knowledge of algorithm. What can you ...
5
votes
1answer
84 views

Algo to return a vector of available time slots for scheduling a meeting between two persons

There are 2 persons and their already booked meeting schedule is given and also time bound for both the person is given. Now, we want to schedule a meeting between them in an available time that suits ...
1
vote
3answers
64 views

Validating an integer with affixes in compile-time or runtime

I'm implementing a function called is_proper_integer that will check the string whether it is a valid integer literal by borrowing the idea from C++ grammar. ...
7
votes
1answer
128 views

Create tweet threads from String in Java

I recently got this question in an exam, this is how I implemented, it is working fine. However, I would like to know if the code can be improved, as I think it for sure needs to be improved. The ...
1
vote
2answers
79 views

Function to skip characters

A very simple function that can be used such that it returns a pointer to the first character on which func returned 0. However, ...
2
votes
3answers
169 views

string to double

I'm trying to write a function to replace the standard std::stod(...). I want to parse the following valid inputs: ...
3
votes
1answer
72 views

garbage string remover with array or object input

This is the second time I am writing any practical JavaScript so it is pretty likely that I have messed something up. I am beginner, so just need a piece of advice before sharing the code: Do I need ...
4
votes
1answer
151 views

A different approach to string pattern matching algorithm

Although there exists the most efficient "Knuth-Morris-Pratt" algorithm of string pattern matching. I tried to achieve the same result with a different approach. But I am not sure about it's ...
-1
votes
2answers
95 views

Find first non repeating char in a string

This is LeetCode question 387 if anyone is interested. The task is to accept a string and find the first char that appears only once, and return its index. If no char appears only once then return -1. ...
10
votes
4answers
3k views

First non-repeating Character, with a single loop in Python

I recently tried to solve the first non-repeating character problem. Please tell me if my solution is valid. I'm aiming for O(n) with a single loop. My thinking is, it would be easy to tell you what ...
1
vote
2answers
57 views

Extracting items from comma/semicolon-delimited strings, discarding parts after a hyphen

New Scala dev here. Is there a more idiomatic or efficient way to accomplish this in Scala? Given a list of the following strings, I need to obtain the unique 'main parts' once any parts including ...
1
vote
1answer
156 views

Fastest string search algorithm

I have invented the fastest string search algorithm. Can someone prove that it is not fastest? I am not considering worst case scenarios. The algorithm can be found here: https://sourceforge.net/...
1
vote
2answers
87 views

Check URL for keywords [closed]

I'm looking at improving my PHP knowledge and wondering if anybody has any tips on improving and optimising my function below? ...
0
votes
1answer
55 views

Rabin karp substring search

Below is the Rabin Karp implementation. I am not so sure about it, and there is no where that I can check whether this code really works or not. It will most helpful for extra set of eyes if whether ...
2
votes
2answers
113 views

Counting uppercase and lowercase characters in a string

I created two programs (one with JAVA8) to calculate the total count of uppercase and lowercase characters in given String. After checking the execution time JAVA8 is taking longer execution time than ...

1
2 3 4 5
56