EzDevInfo.com

letters

A tiny debugging library for Ruby Letters: The tiny debugging library for Ruby

How to check for numbers in a textbox, of which you only want letters A - Z

I am using JavaScript on my website to check input elements within a form. I am trying to ensure that there are no numbers in the field when the user enters their name. The form is created using PHP. I am still in my first year of web design so not sure if there is a function for this. Apologies if this question has been asked, but I haven't found anything. Many Thanks


Source: (StackOverflow)

How can I get the next letter alphabetically without incrementing? (php)

for ($i=A;$i<L;$i++){                   
    echo $i;
    echo '->';
    echo ++$i;
    echo ', ';
}

gives me:

A->B, C->D, E->F, G->H, I->J, K->L

what I want is:

A->B, B->C, C->D, D->E, E->F, F->G

What's the simplest way to do this?


Source: (StackOverflow)

Advertisements

Regex - Match only letters, numbers, and one space between each word

How can I create a regex expression that will match only letters and numbers, and one space between each word?

Good Examples:

Amazing

Hello World

I am 500 years old

Bad Examples:

Hello  world

I am 500 years      old.

I    am   Chuck Norris

Source: (StackOverflow)

How do I get the set of all letters in Java/Clojure?

In Python, I can do this:

>>> import string
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

Is there any way to do something similar in Clojure (apart from copying and pasting the above characters somewhere)? I looked through both the Clojure standard library and the java standard library and couldn't find it.


Source: (StackOverflow)

simplest, shortest way to count capital letters in a string with php?

I am looking for the shortest, simplest and most elegant way to count the number of capital letters in a given string.


Source: (StackOverflow)

OrderBy with Swedish letters

I have a list of my custom class Customer and I want to sort them alphabetically by Title. So I wrote

myList = myList.OrderByDescending(x => x.Title).ToList<Customer>();

Now the problem is that this method doesn't support the Swedish way of sorting the letters å, ä, ö. They should appear at the end after the letter z but they don't.

So I made a workaround method that replaces the Swedish letters before the ordering and then changes them back afterwords. It looks like this but it is quite slow. Can somebody think of a better way?

private List<Customer> OrderBySwedish(List<Customer> myList)
    {
        foreach (var customer in myList)
        {
            customer.Title = customer.Title.Replace("å", "zzz1").Replace("ä", "zzz2").Replace("ö", "zzz3").Replace("Å", "Zzz1").Replace("Ä", "Zzz2").Replace("Ö", "Zzz3");
        }

        myList= myList.OrderBy(x => x.Title).ToList<Customer>();

        foreach (var customer in myList)
        {
            customer.Title = customer.Title.Replace("zzz1", "å").Replace("zzz2", "ä").Replace("zzz3", "ö").Replace("Zzz1", "Å").Replace("Zzz2", "Ä").Replace("Zzz3", "Ö");
        }
        return myList;
    }

Source: (StackOverflow)

How to separate String into chars

public static string kw;

public String parse(String keyword)
{
    this.keyword = keyword;
    char[] letters = keyword.ToCharArray();
    string g;

    long length = System.Convert.ToInt64(keyword.Length.ToString());
    for (int i = 0; i <= length-1; i++)
    {
        kw = "/"+letters[i];
    }
    return kw;
}

So if the keyword is lets say, "Hello". I want this to output /h/e/l/l/o but at the moment its only outputting the last character, in this case /o

Can someone help?


Source: (StackOverflow)

PHP: is there an isLetter() function or equivalent?

I am no PHP expert. I am looking for the PHP equivalent of isLetter() in Java, but I can't find it. Does it exist?

I need to extract letters from a given string and make them lower case, for example: "Ap.ér4i5T i6f;" should give "apéritif'. So, yes, there are accentuated characters in my strings.


Source: (StackOverflow)

MySQL - Case-insensitive search [duplicate]

This question already has an answer here:

Building my search engine for users to search for three variables $Title, $Text and $Number... How do i make it when user searches it finds all results no matter the case type (lower or upper case) user typed in $query?

$query = trim ($query);

$raw_results = mysql_query("SELECT * FROM posts
        WHERE (`Number` LIKE '%".$query."%') OR (`Title` LIKE '%".$query."%') OR (`Text` LIKE '%".$query."%') ") or die(mysql_error());

Source: (StackOverflow)

Sequence of letters in Python

Is there a built-in method / module in Python to generate letters such as the built-in constant LETTERS or letters constant in R?

The R built-in constant works as letters[n] where if n = 1:26 the lower-case letters of the alphabet are produced.

Thanks.


Source: (StackOverflow)

How to detect lowercase letters in Python?

I need to know if there is a function that detects the lowercase letters in a string. Say I started writing this program:

s = input('Type a word')

Would there be a function that lets me detect a lowercase letter within the string s? Possibly ending up with assigning those letters to a different variable, or just printing the lowercase letters or number of lowercase letters.

While those would be what I would like to do with it I'm most interested in how to detect the presence of lowercase letters. The simplest methods would be welcome, I am only in an introductory python course so my teacher wouldn't want to see complex solutions when I take my midterm. Thanks for the help!


Source: (StackOverflow)

How check if letters are in string?

It quite hard question to ask but I will try. I have my 4 letters m u g o . I have also free string word(s).
Let'say: og ogg muogss. I am looking for any wise method to check if I can construct word(s) using only my letters. Please take notice that we used once g we won't be able to use it again.

og - possible because we need only **g** and **o**
ogg - not possible we took **o** and **g**, need the second **g**
muogss - not possible we took all, need also additional **s**

So my tactic is take my letters to char array and remove one by one and check how many left to build the word(s). But is it possible to use somehow in few lines, i do not know - regex ?


Source: (StackOverflow)

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

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 elements;

where countryList is created in C#

List< string> countryList = new List< string>();

Any help or any other efficient way to accomplish above task?


Source: (StackOverflow)

How to correct social media related emphasis words like 'whyyyyy' and 'cooooll' [duplicate]

This question already has an answer here:

Most of the social media related words have more additional letters to emphasis the meaning of the word. (cooool, reallyyy, nooooo ) How can I find the correct words by removing these additional letters? Is there any algorithm or a mechanism to identify the intended word?


Source: (StackOverflow)

Chars scrambling (C# and Javascript)

I need to scramble chars in word. And this scrambling must not be random. In other words, each time of scrambling (on the same word) the new result must be equal to last scramble result (on the same word). Very simple example is XOR. But XOR is very easy to decode and I need something more strength. Could you recommend library for such purpose that identically works on C# and Javascript?

Thank you for any advice!:)


Source: (StackOverflow)