Questions tagged [string]

A string is a finite sequence of symbols, commonly used for text, though sometimes for arbitrary data.

24,066 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
13votes
0answers
274views

Why is the format! macro slower than pushing into a String directly?

When I was trying to generate a string, I used both format! and directly pushed into a String. Pushing into a String directly took ~40 ns/iter while using format! took ~80 ns/iter (twice as long). Why ...
user avatar
11votes
0answers
735views

How to copy selected strings translations from one android project to another?

I have one project with lots of strings and translations. Basically, a lot of values-XX folders in res folder. I want to copy all translations for specific strings into another project. What is the ...
user avatar
9votes
3answers
278views

Minimum add to make parentheses string consisting of '{', '}', '[', ']', '(', ')' valid

This problem is an addition to the familiar stack question(https://leetcode.com/problems/minimum-add-to-make-parentheses-valid/) where we have to return the minimum number of additions to make the ...
user avatar
9votes
2answers
2kviews

Define a C++ char array without terminator

Answers to Why this program compiles fine in C & not in C++? explain that unlike the C language, the C++ language does not tolerate an initializer string for a char array that is not long enough ...
user avatar
9votes
0answers
4kviews

boost::algorithm::to_upper/to_lower ok for utf8? boost::locale not necessary?

I've read in several places that boost::algorithm::to_upper/to_lower are not ok for utf8: http://www.boost.org/doc/libs/1_51_0/libs/locale/doc/html/conversions.html How to convert std::string to ...
user avatar
7votes
0answers
3kviews

Python Tesseract OCR training to a specific list of words

I am quite new to OCR and to Tesseract. So far I have a working script that is extracting fairly good text from images. My doubt: is possible to train tesseract to retrieve only words/chars ...
user avatar
7votes
0answers
5kviews

Is there any characters/bytes limit in the Android clipboard? [Android development]

Good night everyone, Lately, I have been learning about the Android clipboard. I was trying to do some interesting stuff when I discovered that I couldn't copy more than 2^18 (262.144) characters at ...
user avatar
7votes
0answers
1kviews

Get bounding rectangle for CGGlyphs of Characters other then letters or numbers

I am looking for a way to equire character's glyph descent as indicated on the picture: The method needs to work for any given character (or at least all common unicode characters). Here is my ...
user avatar
  • 16.9k
7votes
1answer
2kviews

Manipulating text in a TextBox in Adobe InDesign CS5

How can I do some manipulations with the text in a TextBox on resize in Adobe InDesign CS5? The main goal is too split the last word on every row to achieve something like a custom hyphenation. Is ...
user avatar
  • 7,839
7votes
2answers
2kviews

What is it dot-separated string resource name for?

I'am using a snake_style for the naming of string resources. In someones code i found another notation, with dots. I couldn't be able to found single word about this topic. <resources> <...
user avatar
  • 907
7votes
2answers
4kviews

Correct way of reading /proc/pid/status

I read /proc/<pid>/status this way: std::ifstream file(filename); std::string line; int numberOfLinesToRead = 4; int linesRead = 0; while (std::getline(file, line)) { // do stuff if (...
user avatar
  • 3,068
6votes
2answers
155views

Merge source JSON string to target with similar keys but different structure in javascript

I have two JSON strings as shown below: source = [ { "name": "test1", "values": ["User Support"], "enabled": false }, { "...
user avatar
6votes
1answer
191views

Removing backslash in Python at runtime

I need a way for my function to take in a string at runtime and remove the backslashes while KEEPING the character it is prepended to. So for \a I must get a. This must also work for nonescaped ...
user avatar
  • 159
6votes
1answer
115views

Why does creating 2 variables cause a crash in custom STL, C++ VS2019?

Hello I'm trying to rewrite my own memory manager and STL (nothing fancy, just some basic vector and string features) and I'm getting a strange behaviour. I'm trying to get experience in the memory ...
user avatar
6votes
0answers
468views

Get "path" of nested types as string in Swift

The Problem I'm searching for a generic way to obtain the full name of a nested type in Swift, i.e. when I define nested structs as follows: struct A { struct B { struct C { } ...
user avatar
  • 13.9k
6votes
1answer
464views

Safely concatenate multibyte strings

I'm looking increasingly into ensuring that PHP apps are multibyte-safe, which mostly involves replacing string manipulation functions with their equivilant mb_* functions. However string ...
user avatar
  • 30.1k
6votes
4answers
3kviews

Smallest substring that can be replaced to make the string have the same number of each character

I'm trying to solve a problem that is almost exactly that. In particular I'm given a string s such that s.Length % 4 == 0 and each s[i] is one of 'A', 'C', 'T' or 'G'. I want to find the smallest ...
user avatar
  • 2,719
6votes
2answers
463views

Escaping % in ICS Preferences - Do I really have to write version specific string handling?

I have an app that crashes on ICS. Worked fine up to then (though I'm not sure if I ever really got a honeycomb platform to test on, all of our test phones are either gingerbread or lower, and now I ...
user avatar
  • 741
6votes
2answers
2kviews

Winform TextBox can't display text

Today I found a strange problem with TextBox.Text, if the string length is too large,the textbox will looks like empty, but actually I still can select/copy/paste, just can't see the characters. I ...
user avatar
  • 593
6votes
2answers
5kviews

n-gram modeling with java hashmap

I need to model a collection of n-grams (sequences of n words) and their contexts (words that appear near the n-gram along with their frequency). My idea of was this: public class Ngram { ...
user avatar
  • 665
6votes
1answer
4kviews

Forcing Case Insensitive String.Contains in Entity Framework Core

Is there any way to force LINQ to SQL to perform a case-insensitive Contains? I'm working with PostgreSQL on Entity Framework Core.
user avatar
  • 11.6k
6votes
1answer
2kviews

Why does PyCharm use double backslash to indicate escaping?

For instance, I write a normal string and another "abnormal" string like this: Now I debug it, finding that in the debug tool, the "abnormal" string will be shown like this: Here's the question: ...
user avatar
  • 8,784
6votes
4answers
780views

Arabic string: get actual Glyph (contextual shaping)

I have an arabic String. For instance: رامات راحيل In Arabic, the same letter has a different glyph according to the letter position. So letter Lam is ل if Isolated or Initial, while is ﻟ if it's ...
user avatar
  • 195
6votes
1answer
845views

JS Strings/Numbers and Garbage Collection

tl;dr Does the following line of code create an object (like a JavaScript String object or a JavaScript Number object) to combine the string primitive and the number? var scouterSays = "powerlvl" + ...
user avatar
  • 301
6votes
3answers
4kviews

Concat KeyDown event (Keys) to one C# (wpf) string

I have a magnetic card reader that uses the keyboard input to send data. I am using a KeyDown event where I get this object (C# WPF): KeyEventArgs e I want to take the keys that I get and make them ...
user avatar
  • 975
5votes
1answer
1kviews

PostgreSQL Hibernate-types Data conversion error related to JSONB

Since hibernate does not natively support JSONB, I have implemented custom type. I can read data from table ad_my_table without a problem. However, when writing I am getting data conversion error. I ...
user avatar
5votes
0answers
223views

How to resolve Resource entry already defined

I am using aosp and after running the command: make 2>&1 | tee build-log.txt I am getting lots of errors, such as: packages/apps/Settings/res/values/aliases.xml:19: error: Resource entry ...
user avatar
  • 6,744
5votes
0answers
182views

Is str("str") always an identity function?

So simple question here: I see for certain objects that a call to str can actually create a new object reference >>> a = 1 >>> str(a) is str(a) False However, I notice that this ...
user avatar
  • 16.1k
5votes
0answers
558views

German 'Umlaut's in R package description

I wrote a function in R that replaces german letters like ä, ö, ü and ß and want to document it in my package. My example is: #' @examples "Aber das ist es nun mal, was wir tun: wir träumen weiter ...
user avatar
  • 901
5votes
0answers
260views

Optimizing string manipulation

It is 2019 and we have a banking project which uses mainframe as data store and transactions. We are using DTO's (Commarea, plain c# class) that is converted to plain string (this is how mainframe ...
user avatar
  • 48.8k
5votes
1answer
112views

FirstUnmatchedIndex using CurrentCultureIgnoreCase

I need to support languages that can use non ascii letters in input text, so i need to implement StringComparison.CurrentCultureIgnoreCase for FirstUnmatchedIndex. Ignoring casing isn't so bad, but i ...
user avatar
  • 754
5votes
0answers
183views

Are Java Strings stored differently in heap based on how they are being constructed?

I'm working on a code base which uses JNI techniques for modeling native methods. Here is the segment of the native peer method used for java.lang.String#equals(Object) @MJI public boolean ...
user avatar
5votes
0answers
1kviews

Vue directive - passing in string

I have the following custom directive in vue <h1 v-role="'admin'">Your Dashboard</h1> It works fine but would be cleaner without the single quotes. Is this possible? <h1 v-...
user avatar
  • 15.8k
5votes
0answers
1kviews

Get string length at declaration in assembly x86_64 in Linux

See the statements of string1 and string2 as well as their len1 and len2. The code is Assembly for x86_64 using GNU Assembler, passing parameters to invoke Linux x86_64 system calls. When I mov len1, %...
user avatar
  • 2,342
5votes
0answers
232views

Handle several chained-function with python multiprocessing (pool)

Coding is pretty new for me, so don't mind me if what I'm asking is quite easy or idiotic. I wrote a python script for doing some obscure stuff, long story short, I'm trying to compare some strings ...
user avatar
  • 51
5votes
0answers
1kviews

How to color different parts of text drawn on a canvas in Android?

I am trying to recreate the following animation: The animation GIF can be accessed here: https://github.com/ugomeda/d3-liquid-fill-gauge In this animation, as the waves rise and fall, the color of ...
user avatar
5votes
1answer
298views

@Html.TextBoxFor throws System.FormatException when the localized string contains curly brace character

@Html.TextBoxFor throws System.FormatException when the localized string contains curly brace character public class MyModel { [Display(ResourceType = typeof(MyModelResourceProvider), Name="...
user avatar
  • 713
5votes
3answers
339views

How would I Strip Html from a string and set a character limit?

I'm getting a string from a list of items, The string is currently displayed as "item.ItemDescription" (the 9th row below) I want to strip out all html from this string. And set a character limit of ...
user avatar
  • 169
5votes
1answer
103views

PHP How To convert a list of strings (array) to an nested array based on string content

I have a list of strings with contain keywords. //random keywords random order $array = array( 'Keyword7 keyword4 keyword9 keyword1' 'keyword4 keyword9 Keyword7 keyword2' 'Keyword7 ...
user avatar
  • 3,796
5votes
1answer
2kviews

ComboBox searching in string, not just the first letter

I have problem making my combobox searching inside the strings in the items. I want to narrow down a list of members. They are formatted in this way (unique member id) - First name - last name. When ...
user avatar
5votes
0answers
1kviews

GSON is trying to deserialize a String to double

I'm using Retrofit with a GSON converter to obtain JSON from a RESTful Web Service and when GSON tries to convert a JSON object to POJO I'm getting the error: retrofit.Converter:conversionException:...
user avatar
5votes
1answer
118views

Array detects only a part from an input word instead of the entire word

I have a problem in my Android app, it's an app using voice recognition, and Google TTS. It's like a SIRI client. As you can see here when the user says a word given in the array: String[] g = { "...
user avatar
5votes
1answer
3kviews

Why is using def and String at the same time when declare field in Gradle

class GreetingPluginExtension { def String message = 'Hello from GreetingPlugin' } Why is used def and String at the same time, we have String type, why we use and def keyword?
user avatar
  • 15.6k
5votes
0answers
134views

Case-insensitive compare of Turkish file names in .NET

How should file names be compared in .NET? I've read that InvariantCulture is preferred, but here's my problem... A case-insensitive compare of a Turkish file name with the classic "I" vs. "i" issue,...
user avatar
  • 4,340
5votes
2answers
7kviews

break program when user enters specific string into input

I want to make it so that the user inputs some string, and the program takes console input until user types "/done".. so here's how it would work: print to user: enter your string user enters: hello ...
user avatar
5votes
1answer
1kviews

Android c++ string support for to_string, stof, etc

Does any android ndk compiler, based on gcc 4.7, support to_string, stof, and other string conversion functions? In the NDK I am using I found the function in ext/vstring.h. But the function is ...
user avatar
  • 341
5votes
1answer
2kviews

android how to get Click String in android Webview?

How can I get String from webview on its click event?? here is the image: here i just want to fetch the blue colored strings programmatically and not the other ones. i am using Html string Display ...
user avatar
5votes
1answer
2kviews

Best way to iterate over a byte/unicode string in Cython

I'm just beginning with Cython and it also turns out very hard to google Cython-specific stuff, so sorry in advance. I am re-implementing a Python function with Cython. It pretty much looks like this ...
user avatar
5votes
0answers
2kviews

mysql bitwise operations with string columns

I need to store some flags for user records in a MySQL table (I'm using InnoDB): --------------------------- | UserId | Mask | | ------------------------- | 1 | 00000...001 | | 2 ...
user avatar
5votes
1answer
3kviews

Iterate over characters in string in mysql

First at all I have a very concrete question, but maybe an alternative approach to my problem (second part) could also help me. Is there a way to address a character in a string via its index in ...
user avatar

15 30 50 per page
1
2 3 4 5
482