Category "string"

Java How to validate characters using a string?

I am working on a java project and was wondering how I could use a string to determine whether or not the chars in an array are valid. The given string is final

Merge column into one string from 2D list

I want to merge one column into one string from 2D list. Are there better ways to merge it? lists = [['H', 'W'], ['e', 'o'], ['l', 'r'], ['l', 'l'], ['o','d']]

Regex to match anything after a delimiter

I have the following case: Time format and some description which is separated by a delimiter - (as like below) 00:00 - Hello element I was using the below rege

How to split a readLine but dont split values inside apostrophes?

Example txt file ADD 'Cordless Screwdriver' 30 1 2 COST 'Multi Bit Ratcheting' FIND 'Thermostat' FIND 'Hand Truck' SELL 'Hammer' 1 QUANTITY 'Paint Can' FIRE 'Jo

Return Value from Function is None

Hello So i created a function to see if every character of a string is valid to be changed from base 10 to base 2(binary for example) but i dont know why everyt

Replace substring till space is found after specified position in PHP

I have this main string $string = "This is a sample text"; $substring = substr_replace($string, "", 11 , 6); Output: This is a text I'm passing $string varia

In Clojure, passing number with leading 0s to str causes strange behavior. What feature is this?

So, I accidentally figured this out while playing around with some strings. (str 111) => "111" (str 0111) => "73" What is this?

How are char arrays / strings stored in binary files?

When I compile this code using different compilers and inspect the output in a hex editor I am expecting to find the string "Nancy" somewhere. #include <stdi

VB Net Quotes in a string

I need quotes in a string in VB Net. c = C:\test.doc How can I realize that the string looks like: PrintFile /File="C:\test.doc" /OutputFile="C:\test.pdf" onl

How do I force r to print character strings with single quotes?

I'm writing some code that interfaces with SQL, and I need my character strings to print with single quotes, but R defaults to double quotes. When I go to ?Quot

How do I compare strings in Java?

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals()

Pointers - Strings

I have a code chunk which is quite meaningless for me. Is there someone can explain it to me? Thanks int strLength(char *str) { char *p = str; // Go until the e

How to write c++ code to reverse a string without using inbuilt function?

I have write this code. It does not show any error but string is not reversed.please let me know where i have made the mistake? I'm using codeblock to write cod

Removing trailing newline character from fgets() input

I am trying to get some data from the user and send it to another function in gcc. The code is something like this. printf("Enter your Name: "); if (!(fgets(Na

Create rectangle from given words by some rules

i got this task to make, but i am completely lost. I don't know how to make this... Could you please give me some ideas? I started making it and only thing i ma

Version strings to "System.Version" too long (or short) in PowerShell

How can I force conversion to type System.Version in PowerShell, or more likely, better understand why I cannot arbitrarily assign number strings type System.Ve

How do I compare strings in Java?

I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals()

I tried to get the user input and then compare it to somthing and i got a problem [duplicate]

I tried to get the user input and then compare it to somthing and i got a problem :( this is my code: use std::io::stdin; fn main() { let

How to create an array of random security codes in Java? [duplicate]

I am trying to write a program that would ask the user how many security codes he wants to generate, then it would output as many codes as he

Why is conversion from string constant to 'char*' valid in C but invalid in C++

The C++11 Standard (ISO/IEC 14882:2011) says in § C.1.1: char* p = "abc"; // valid in C, invalid in C++ For the C++ it's OK as a pointer to a String Lit