letters

add number to a character to make it another character

有些话、适合烂在心里 提交于 2019-12-12 01:22:27
问题 I want to have a char, add number to it and get another char(a+2=c) int leng,leng2; String word = ""; String key = ""; String enc =""; char x; char z; char tost; System.out.println("gimme word"); word=in.next(); System.out.println("gimme key"); key=in.next(); leng=word.length(); leng2=key.length(); for(int i=1;i<=leng;i++) { z=word.charAt(i-1); x=key.charAt(i-1); int plus=z + x; tost=(char)plus; enc=enc+tost; System.out.println(enc); System.out.println(tost); System.out.println((char)z);

PHP imagettftext: bounding boxes of letters superimpose above each other

拟墨画扇 提交于 2019-12-11 18:27:55
问题 I'm writing text-images on the fly with PHPs imagettftext , which works fine so far, but I have a very strange problem. We are using a very italicized font and apparently the bounding boxes of later letters are sometimes superimposing their background over previous letters, thus cutting into them. Now, I can't seem to find a way to tell imagettftext to use a transparent background for the font (for the image itself it's not a problem). So, anyone has an suggestion how to get rid of those cuts

Combining two strings into one string which eliminates the same letters in C

泪湿孤枕 提交于 2019-12-11 16:46:12
问题 Hello i'm so new in the programming and want to learn some from you :) I'm doing a program in .c and i am stucked in a part. I want to get 3 or more inputs max size of 5 characters. (For example: HELLO, HI, GOOD, BYE) And i want to stack them in a new string which holds same letters only once from those 4 strings (Example: H,E,L,L,O,I,G,D,B,Y) #include <stdio.h> #include <string.h> int main(void) { char first[5], second[5], third[5], fourth[5]; printf("Enter 1st word: \n"); scanf(" %5s",

Project Euler Problem 17 - What's wrong?

时光毁灭记忆、已成空白 提交于 2019-12-11 07:36:41
问题 I decided to try project euler problem 17 today, and I quickly wrote a pretty fast code in C++ to solve it. However, for some reason, the result is wrong. The question is: If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? NOTE: Do not count spaces or hyphens. For example, 342 (three hundred

Regular Expression for all letters in all alphabets with spaces exept anything else

纵然是瞬间 提交于 2019-12-11 06:44:25
问题 I'm trying to make a name field filter with jQuery and I tried so many regular expressions and no of them work fully. All I need is to make the name field as the name field - nothing else, e.g. Adam Jeremy Smith for example. So there would be no possibility to type $ or / or _ or ~ or 0-9 or anything else? How to do this? I thought it should be: /[^\\p{L}]+([^0-9])+$/ Yeah it works only if you type e.g. 'Adam Je4' but if you continue and write 'Adam Je4remy' it doesn't work and validates it

How do computers differentiate between letters and numbers in binary?

情到浓时终转凉″ 提交于 2019-12-11 03:08:54
问题 I was just curious because 65 is the same as the letter A If this is the wrong stack sorry. 回答1: Short answer. They don't. Longer answer, every binary combination between 00000000 and 11111111 has a character representation in the ASCII character set. 01000001 just happens to be the first capital letter in the Latin alphabet that was designated over 30 years ago. There are other character sets, and code pages that represent different letter, numbers, non-printable and accented letters. It's

stream的filter、map和flatMap方法

牧云@^-^@ 提交于 2019-12-07 20:58:21
Java核心技术 卷二 filter、map和flatMap方法 流的转换会产生一个新的流,它的元素派生自另一个流中的元素。 List < String > wordList = . . . . ; Stream < String > longWords = wordList . stream ( ) . filter ( w - > w . length ( ) > 12 ) ; 将所有的单词转化成小写 Stream < String > lowercaseWords = words . stream ( ) . map ( String : : toLowerCase ) ; 这里使用的是带有方法引用的map 或者 Stream < String > firstLetters = words . stream ( ) . map ( s - > s . toLowerCase ( ) ) ; public static Stream < String > letters ( String s ) { List < String > result = new ArrayList < > ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { result . add ( s . subString ( i , i + 1 ) )

Linq query - find strings based upon first letter b/w two ranges

孤者浪人 提交于 2019-12-07 08:46:08
问题 We have a list containing names of countries. We need to find names of countries from list b/w two letters. Like names of all countries with name starting b/w A-G and so on. We create following linq query but its ugly. var countryAG = from elements in countryList where elements.StartsWith("A") || elements.StartsWith("B") || elements.StartsWith("C") || elements.StartsWith("D") || elements.StartsWith("E") || elements.StartsWith("F") || elements.StartsWith("G") || elements.StartsWith("H") select

How to do a character search in any order (12 letters from which 6 should form a word) with PHP?

北战南征 提交于 2019-12-06 07:53:42
问题 I am thinking about this all day and can't seem to figure out an memory efficient and speedy way. The problem is: for example, I have these letters: e f j l n r r t t u w x (12 letters) I am looking for this word TURTLE (6 letters) How do I find all the possible words in the full range (12 words) with php? ( Or with python, if that might be a lot easier? ) Things I've tried: Using permutations: I have made all strings possible using a permutation algorithm, put them in array (only the ones 6

How to count how many different vowels are in one word from text file in C?

无人久伴 提交于 2019-12-04 06:15:42
问题 I am confused about counting how many differents vowels are in one word? This is were i got so far... I am saving word by word in the variable word[] and then check char by char whether is vowel or not... but i don't know how to count how many different vowels are in the word? Please help. Thanks in advance. int i,j,words = 0; while(fgets(row,MAX,f) != NULL) { int flag = 0; int n = 0; for(i = 0; i < strlen(row); i++) { if(isalpha(row[i])) { if(!flag) { flag = 1; } word[n++] = row[i]; } else