The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
77 views

Assigning strings to pointer in C Language

I am a new learner of C language, my question is about pointers. As far i learned and searched pointers can only store addresses of other variables, but cannot store the actual values(like integers or ...
-1
votes
1answer
61 views

Choosing a file format to storage a simple text data [closed]

My .NET application makes its work and then creating a report (an Excel worksheet). The report holds thousands of short text strings [KEY - VALUE], so excel worksheets suites very well, one column ...
0
votes
0answers
14 views

How to change the content of a string in python [migrated]

I have a blog in the following website http://ecosdobigbang.com/ where I'll post material that is relevant to Physics students that speak portuguese (the target audience of this post are physics ...
1
vote
4answers
480 views

Regex to String generation

Let's say that we have a regex and an index i. If we suppose that the set of strings that match our regex are sorted in a lexicographical order, how could we get the i element of this list? Edit : I ...
0
votes
1answer
52 views

exception for string literal conventions

If I'm used to use ' for string literals in PHP, would it be better if I'll stick to it in any situation or can there be exceptions when it would increase readability? example: $foo = "bar'baz"; // ...
0
votes
2answers
251 views

Why doesn't Ruby have implicit conversion of Fixnum into String?

Ruby normally makes things easy. However, it doesn't allow implicitely converting a number to a string: 2.0.0p247 :010 > "a"+1 TypeError: no implicit conversion of Fixnum into String Why is this ...
0
votes
0answers
32 views

Search substring using suffix array (and LCP)

I'm searching for a best way to improve suffix array run time using LCP. My text (about 2 500 000 chars) seems like: 0ricco0eric0america0polo0.... My thoughs: SA=suffixArray char=firstChar(input) s ...
1
vote
1answer
86 views

Algorithm to create permutations for a given alphabet based on a sequence number

I would like to have a function that will create a word (always the same word) for a given sequence number based on a given alphabet. word(0, [a,b,c]) = a word(1, [a,b,c]) = b word(2, [a,b,c]) = c ...
-1
votes
2answers
165 views

Word recognition in a string without spaces or punctuation marks

I have a small C# project that reads a file and gives me an output: a string that does not contain spaces nor any types of punctuation marks. It may also contain a few misspellings. Ex. Output: ...
1
vote
2answers
167 views

What's the difference of an object being final and an object being immutable in java?

final String str = "do not change me"; str = "why not?"; //it will result in compile time error saying that final fields can not be re-assigned once created i.e. the reference cannot be changed ...
0
votes
3answers
145 views

How can I handle this string concatenation in C in a reusable way

I've been writing a small C application that operates on files, and I've found that I have been copy+pasting this code around my functions: char fullpath[PATH_MAX]; fullpath[0] = '\0'; ...
-4
votes
1answer
89 views

Using strings in different projects (visual studio) [closed]

Is it possible to grab a string from one project (written in VB.net) and use it in another project (written in C#) ? I understand I can use pipeline, but I'm not exactly sure how. Edit: I have a ...
0
votes
0answers
38 views

Algorithm for HIghest Local Alignment Score with a specific character match between two subsequences

I'm writing a code that identifies the highest-scoring local alignment between a substring X' of X and a substring Y' of Y that has at least one column in which a C from X' is aligned to a W from Y'. ...
1
vote
0answers
123 views

What is the purpose of chunking strings in natural language processing?

I see many examples of libraries that use a 'chunker' and also people asking how to write chunkers, but what is this for and why do we need it? Isn't it enough to split a text by whitespace or other ...
5
votes
4answers
512 views

Why doesn't Haskell have a 'format' function for string interpolation?

I'm trying to use Shake and I stumbled upon the following problem: there's no easy and convenient way to interpolate a string. I know about Text.Printf — it's not what I'm looking for. The ...
1
vote
4answers
203 views

How can I take a list of tokens (of variable number) and know what each token means?

I have to read a text document with data formatted as follows: (a couple of examples) 07 M W F 1400 1450 C 2004 M W F 0900 1030 EN 2036 06 M T R 1300 1350 EN 1003 17 T R 0900 1015 EN 1052 The ...
1
vote
1answer
108 views

Search Substring in String collection

I have a big collection of strings a[1], …, a[N] where N is about several millions. I am provided a string m and I need to iterate over all the strings a[i] that contain m. In other words, I need to ...
11
votes
3answers
1k views

How many strings are created in memory when concatenating strings in Java?

I was asked about immutable strings in Java. I was tasked with writing a function that concatenated a number of "a"s to a string. What I wrote: public String foo(int n) { String s = ""; for ...
2
votes
1answer
116 views

Comparing strings against a pool of words

I am creating an app where the user enters 8 characters. After he enters the string I have to see if it is an eight letter word. If not, check if contains a seven letter word etc. I am checking ...
1
vote
1answer
126 views

String Formatting with concatenation or substitution [closed]

This is a question about preferences. Assume a programming language offers these two options to make a string with some variables: "Hello, my name is ". name ." and I'm ". age ." years old." ...
2
votes
6answers
362 views

Settle an Argument: String vs. Array?

True or False: A string is the same thing as an array. I had an interview the other day and the above question was asked. I said false, but the interviewer said it was actually true. I explained to ...
-1
votes
5answers
470 views

How common is string manipulation, really? [closed]

I've noticed a lot of programming introductions (almost any language) usually include a heavy barrage of string manipulation quite early, such as: Count the number of "xx" in the given string. We'll ...
0
votes
1answer
80 views

Code execution within delimiters

Is there any way I can execute a block of code in a loop, like so: [ some code goes here ] Where the delimiters are "[" and "]", and also allowing for nested blocks, i.e.: [the user can create ...
8
votes
1answer
223 views

Match two strings but allow for a degree of error

How can I match two strings, but at the same time allow for X number of characters to be incorrect in the match. The number of errors should be a controllable variable. While X number of characters ...
1
vote
1answer
255 views

PHP Simplest XML tokenizer for string processing?

I need to do some text processing tasks with short XML fragments. The section "details" shows an example... My solution is to use a tokenizer based on regular expresions, but it is not elegant and not ...
-1
votes
6answers
1k views

Converting an empty string to a number [closed]

If you are designing a function which should conver a string to an integer, how would you convert an empty string? The question is only about this one particular input value (empty string). Between ...
0
votes
4answers
465 views

What does it mean to perform an operation “In Place” for Interpreted Languages?

Programming question: Reverse words in a string (words are separated by one or more spaces). Now do it in-place. What does "in-place" mean in the above context for an interpreted language ...
8
votes
1answer
609 views

Possible Damerau-Levenshtein improvement?

I recently implemented the Damerau-Levenshtein distance algorithm from the pseudocode on Wikipedia. I couldn't find any explanation of exactly how it works and the pseudocode uses completely ...
0
votes
3answers
92 views

How to manage intermediate outputs efficiently?

I am implementing a C preprocessor in C... I have the three functions: trigraph replacing function Line splicing function comment removing function However these functions work separately on ...
2
votes
5answers
1k views

A string is immutable, so why are they not all constants?

The string type is immutable. We can use the const keyword with strings in high level language like .NET. My understanding of 'const' means constant (it remains the same, we can't change the value). ...
7
votes
3answers
429 views

Longest subsequence without string

Does there exist a dynamic programming algorithm to find the longest subsequence in a string X that does not contain Y as substring? Just that this problem seems so similar to other DP string ...
6
votes
2answers
216 views

Index independent character comparison within text blocks

I have the following task: developing a program where there is a block of sample text which should be typed by user. Any typos the user does during the test are registered. Basically, I can compare ...
0
votes
1answer
198 views

Algorithm Identification [ String & Dictionary ]

I recently heard of an interview question: Given a string and a dictionary. Break the string into meaningful words and I remember solving this before with dynamic programming fairly quickly (maybe ...
3
votes
5answers
3k views

How do you compress ASCII strings into smaller bytes?

I'm working with an embedded device with a unique protocol that sends messages to other devices and I'm making an application that parses the sent packets. Each packet carries 8 bytes. The protocol is ...
4
votes
4answers
33k views

Initializing char array with string

I don't remember how I got to the thread, but I was reading its replies and one of them states that you should never initialize a char[] with a string literal. My question: Is initializing a ...
6
votes
2answers
3k views

Which string search algorithm is actually the fastest?

I have been stuck for some time on which is the fastest string search algorithm, heard many opinions, but in the end I'm not sure. I have heard some people saying that the fastest algorithm is ...
6
votes
1answer
367 views

Finding occurrences of a useful words and phrases in strings

I am building an app that analyzes posts by people by pulling their Tweets and Facebook posts. I need to process all the posts and find useful phrases. What I mean by useful is that, any word or ...
3
votes
3answers
206 views

Storing lots of large strings with frequent “appends” and few reads

In my current project, I need to store a very long ASCII string to each instance of a given object. This string will receive an 2 appends per minute and will not be retrieved so frequently. The ...
1
vote
2answers
358 views

Looking for a non-cryptographic hash function that returns a single character

Suppose I have a dictionary of ASCII words stored in uppercase. I also want to save those words into separate files so that the total word count of each file is approximately the same. By simply ...
-2
votes
1answer
237 views

C Minishell Command Expansion Printing Gibberish

I'm writing a unix minishell in C, and am at the point where I'm adding command expansion. What I mean by this is that I can nest commands in other commands, for example: $> echo hello $(echo ...
17
votes
2answers
4k views

Why does Java use UTF-16 for internal string representation?

I would imagine the reason was fast, array like access to the character at index, but some characters won't fit into 16 bits, so it wouldn't work... So if you have to handle special cases anyways, ...
1
vote
1answer
128 views

How to implement string matching based on a pattern

I was asked to build a tool that can identify if a string match a pattern. Example: {1:20} stuff t(x) {a,b,c} would match: 1 stuff tx a 20 stuff t c It is a sort of regex but with a ...
6
votes
2answers
593 views

Complex string matching with fuzzywuzzy

I'm attempting to write a process that matches obscure strings to a single 'master string' for further processing. I have a lot of data that looks something like this: Basketball Basket Ball Football ...
6
votes
1answer
3k views

Shortest Common Superstring: find shortest string that contains all given string fragments

Given some string fragments, I would like to find the shortest possible single string ("output string") that contains all the fragments. Fragments can overlap each other in the output string. ...
7
votes
2answers
9k views

When should I use StringBuilder or StringBuffer?

In a production web application, my fellow programmers used StringBuffer everywhere. Now I am taking care of application development and corrections. After reading StringBuilder and StringBuffer I ...
2
votes
2answers
119 views

What direction should I consider the offset when searching strings in reverse?

I'm making an indexOfReverse utility function in my C++ program, and I have caught a bit of a snag. Implementing the offset and maxOffset in my indexOf was very intuitive to me.. These start from the ...
2
votes
3answers
349 views

Why are the arguments for substring functions mismatched?

In many languages, the substring function works like this: substring(startIndex, endIndex) returns the substring from startIndex until endIndex-1 (if you view startIndex and endIndex as 0-based) / ...
6
votes
4answers
561 views

Should functions of a C library always expect a string's length?

I'm currently working on a library written in C. Many functions of this library expect a string as char* or const char* in their arguments. I started out with those functions always expecting the ...
8
votes
1answer
1k views

How does PHP internally represent strings?

UTF8? UTF16? Do strings in PHP also keep track of the encoding used? Let's look at this script for example. Say I run: $original = "शक्नोम्यत्तुम्"; What actually happens? Obviously I think ...
10
votes
6answers
2k views

Is it inefficient to concatenate strings one at a time?

I recall back from my days of programming in C that when two strings are joined, the OS must allocate memory for the joined string, then the program can copy all the string text over to the new area ...