Latest Questions tagged Character

Browse all latest questions tagged Character

45
Votes
Published 04 Sep, 2022
Java - How to get the number of characters in a JTextField?

Is there a event on how to count the inputted character in a JTextField?

83
Votes
Published 03 Jul, 2022
Jquery - How to use jQuery to onsubmit and check if the value is 2 - 5 characters?

Let's say I have a text field: Username: <input type="text" id="username" class="required" /> <input type="submit" /> and I have some jQuery: $(document).ready(function() { user =...

379
Votes
Published 16 Apr, 2022
Javascript - Repeat a string in JavaScript a number of times

In Perl I can repeat a character multiple times using the syntax: $a = "a" x 10; // results in "aaaaaaaaaa" Is there a simple way to accomplish this in Javascript? I can obviously use a function, b...

17
Votes
Published 15 Sep, 2022
Java - Remove all occurrences of char from string

I can use this: String str = "TextX Xto modifyX"; str = str.replace('X','');//that does not work because there is no such character '' Is there a way to remove all occurrences of character X from a...

43
Votes
Published 25 Aug, 2022
Java - Recursively counting character occurrences in a string

Im making a program to count the number of times a character is found in a string. This is what my method looks like: public static int count (String line, char c) { int charOccurences = 0; //= 0...

122
Votes
Published 16 Apr, 2022
Javascript - How to check if character is a letter in Javascript?

I am extracting a character in a Javascript string with: var first = str.charAt(0); and I would like to check whether it is a letter. Strangely, it does not seem like such functionality exists in J...

550
Votes
Published 16 Apr, 2022
Javascript - What characters are valid for JavaScript variable names?

Which characters can be used for naming a JavaScript variable? I want to create a small "extension library" for my non-JavaScript users here at work (who all seem to be squeamish when it comes to the...

74
Votes
Published 06 May, 2022
Python - Get character position in alphabet

I'm 90% sure there is a built in function that does this. I need to find the position of a character in an alphabet. So the character "b" is position 1 (counting from 0), etc. Does anyone know what t...

58
Votes
Published 20 Jun, 2022
Python - Regex to match all Hangul (Korean) characters and syllable blocks

I'm trying to validate user input (in Python) and see if the right language is being used, Korean in this case. Lets take the Korean word for email address: 이메일 주소 I can check each character lik...

42
Votes
Published 06 Aug, 2022
Python - Pandas: get second character of the string, from every row

I've a array of data in Pandas and I'm trying to print second character of every string in col1. I can't figure out how to do it. I can easily print the second character of the each string individuall...

218
Votes
Published 06 May, 2022
Python - What is the difference between a string and a byte string?

I am working with a library which returns a byte string and I need to convert this to a string. Although I'm not sure what the difference is - if any.

89
Votes
Published 02 Sep, 2022
Java - When should you close a scanner?

I've been trying to read input from a file and classifying its characters. Printing how many characters are uppercase letters, lowercase letters, digits, white space, and something else in the text f...

93
Votes
Published 29 Jul, 2022
Python - python pexpect sendcontrol key characters

I am working with pythons pexpect module to automate tasks, I need help in figuring out key characters to use with sendcontrol. how could one send the controlkey ENTER ? and for future reference how c...

20
Votes
Published 22 Jun, 2022
Python - In Python, how to check if a string only contains certain characters?

In Python, how to check if a string only contains certain characters? I need to check a string containing only a..z, 0..9, and . (period) and no other character. I could iterate over each character...

297
Votes
Published 31 Aug, 2022
Java - Replace a character at a specific index in a string?

I'm trying to replace a character at a specific index in a string. What I'm doing is: String myName = "domanokz"; myName.charAt(4) = 'x'; This gives an error. Is there any method to do this?