Search Results

Search found 35302 results on 1413 pages for 'string literals'.

Page 46/1413 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • php function to make slug (url string)

    - by andufo
    function gen_slug($str){ # special accents $a = array('À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö','Ø','Ù','Ú','Û','Ü','Ý','ß','à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î','ï','ñ','ò','ó','ô','õ','ö','ø','ù','ú','û','ü','ý','ÿ','A','a','A','a','A','a','C','c','C','c','C','c','C','c','D','d','Ð','d','E','e','E','e','E','e','E','e','E','e','G','g','G','g','G','g','G','g','H','h','H','h','I','i','I','i','I','i','I','i','I','i','?','?','J','j','K','k','L','l','L','l','L','l','?','?','L','l','N','n','N','n','N','n','?','O','o','O','o','O','o','Œ','œ','R','r','R','r','R','r','S','s','S','s','S','s','Š','š','T','t','T','t','T','t','U','u','U','u','U','u','U','u','U','u','U','u','W','w','Y','y','Ÿ','Z','z','Z','z','Ž','ž','?','ƒ','O','o','U','u','A','a','I','i','O','o','U','u','U','u','U','u','U','u','U','u','?','?','?','?','?','?'); $b = array('A','A','A','A','A','A','AE','C','E','E','E','E','I','I','I','I','D','N','O','O','O','O','O','O','U','U','U','U','Y','s','a','a','a','a','a','a','ae','c','e','e','e','e','i','i','i','i','n','o','o','o','o','o','o','u','u','u','u','y','y','A','a','A','a','A','a','C','c','C','c','C','c','C','c','D','d','D','d','E','e','E','e','E','e','E','e','E','e','G','g','G','g','G','g','G','g','H','h','H','h','I','i','I','i','I','i','I','i','I','i','IJ','ij','J','j','K','k','L','l','L','l','L','l','L','l','l','l','N','n','N','n','N','n','n','O','o','O','o','O','o','OE','oe','R','r','R','r','R','r','S','s','S','s','S','s','S','s','T','t','T','t','T','t','U','u','U','u','U','u','U','u','U','u','U','u','W','w','Y','y','Y','Z','z','Z','z','Z','z','s','f','O','o','U','u','A','a','I','i','O','o','U','u','U','u','U','u','U','u','U','u','A','a','AE','ae','O','o'); return strtolower(preg_replace(array('/[^a-zA-Z0-9 -]/','/[ -]+/','/^-|-$/'),array('','-',''),str_replace($a,$b,$str))); } Works great, but i've found some cases in which it fails: echo gen_slug('andrés'); returns andras instead of andres why? any ideas on the preg_replace parameters?

    Read the article

  • Printing a string and variable in MIPS

    - by Matt
    Here's the C representation of what I'm trying to do in MIPS assembly: printf ("x=%d\n", x); I know that I can do a syscall to easily print x= and I can also do a syscall to print the int x (which is stored in a register). However, that prints them like this (let's say x is 5): x= 5 How can I make them print on the same line?

    Read the article

  • Finding unique elements in an string array in C

    - by LuckySlevin
    Hi, C bothers me with its handling of strings. I have a pseudocode like this in my mind: char *data[20]; char *tmp; int i,j; for(i=0;i<20;i++) { tmp = data[i]; for(j=1;j<20;j++) { if(strcmp(tmp,data[j]))//then except the uniqueness, store them in elsewhere. } } But when i coded this the results were bad.(I handled all the memory stuff,little things etc.) The problem is in the second loop obviously :D. But i cannot think any solution. How do i find unique strings in an array. Example input : abc def abe abc def deg entered unique ones : abc def abe deg should be found.

    Read the article

  • PHP String Encoding Error

    - by Brian
    I'm trying to get the following code to output an IMG tag with the URL for Google Static Maps API http://code.google.com/apis/maps/documentation/staticmaps/#Imagesizes embedded in there... the result is that everything except the $address is being output successfully... what am I doing wrong? function event_map_img($echo = true){ global $post; $address = get_post_meta($post->ID, 'date_address', true); if($echo): echo '<img src="'.'http://maps.google.com/maps/api/staticmap?center='.$address.'&zoom=14&size=700x512&maptype=roadmap&markers=color:blue|label:X|'.$address.'&sensor=false" />'; else: return '<img src="'.'http://maps.google.com/maps/api/staticmap?center='.$address.'&zoom=14&size=700x512&maptype=roadmap&markers=color:blue|label:X|'.$address.'&sensor=false" />'; endif; }

    Read the article

  • java - how to split string in to multiple parts?

    - by Ewen
    I have a string that contains a value "firstword second third", and an ArrayList. I want to split the whole string in to by spaces and add the splitted strings in to the ArrayList. For example,"firstword second third" can be split to three separate strings and added three times in to the ArrayList. "1 2 3 4" can be splitted in to 4 strings and added 4 times in to the ArrayList. See the code below: public void separateAndAdd(String notseparated) { for(int i=0;i<canBeSepartedinto(notseparated);i++{ //what should i put here in order to split the string via spaces? thearray.add(separatedstring); } } public int canBeSeparatedinto(String string) //what do i put here to find out the amount of spaces inside the string? return .... } Please leave a comment if you dont get what I mean or I should fix some errors in this post. Thanks for your time!

    Read the article

  • Python string formatting too slow

    - by wich
    I use the following code to log a map, it is fast when it only contains zeroes, but as soon as there is actual data in the map it becomes unbearably slow... Is there any way to do this faster? log_file = open('testfile', 'w') for i, x in ((i, start + i * interval) for i in range(length)): log_file.write('%-5d %8.3f %13g %13g %13g %13g %13g %13g\n' % (i, x, map[0][i], map[1][i], map[2][i], map[3][i], map[4][i], map[5][i]))

    Read the article

  • sed: search and replace string with line number

    - by tigerstyle
    Hi volks, I have a XML file with a lot of empty tag attributes. For instance: <mytag id=""> <ontent>aaa</content> </mytag> <mytag id=""> <ontent>bbb</content> </mytag> <mytag id=""> <ontent>ccc</content> </mytag> Now I want to replace id="" with e.g. id="2443" (id="[linenumber]") I tried to do this with sed, but I did not get a successful result. I hope someone here can help me :-)

    Read the article

  • how to escape a string before insert or update in Ruby

    - by ywenbo
    Hi guy, In ruby ActiveRecord doesn't provide dynamic binding for update and insert sqls, of course i can use raw sql, but that need maintain connection, so i want to know if there is simpler way to escape update or insert sql before executing like code below: ActiveRecord::Base.connection.insert(sql) i think i can write code by gsub, but i know if there has been a ready method to do it. thank you very much, and Merry Christmas for you all.

    Read the article

  • Find most common string in an array

    - by j.
    I have this array, for example (the size is variable): x = ["1.111", "1.122", "1.250", "1.111"] and I need to find the most commom value ("1.111" in this case). Is there an easy way to do that? Tks in advance!

    Read the article

  • Organizing a String based on maxlength of each field

    - by pringlesinn
    I've made a program that makes my life easier by reading a class and creating methods like these below: //Ferramentas Parâmetros acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Pesquisa", "ppaParametrosList", null, TipoAcessoBean.TELA)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Gravar", "ppaParametrosHome", "persist", TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Atualizar Dados", "ppaParametrosHome", "update", TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Leitura", "ppaParametrosHome", "find", TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Excluir", "ppaParametrosHome", "remove", TipoAcessoBean.ACAO)); Don't worry about the language. It won't make it harder to understand what I need to make. I want to organize it to be shown like this: //Ferramentas Parâmetros acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Pesquisa" , "ppaParametrosList", null , TipoAcessoBean.TELA)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Gravar" , "ppaParametrosHome", "persist", TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Atualizar Dados", "ppaParametrosHome", "update" , TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Leitura" , "ppaParametrosHome", "find" , TipoAcessoBean.ACAO)); acessos.add(new AcessoBean("Ferramentas", "Parâmetros", "Parâmetros", "Excluir" , "ppaParametrosHome", "remove" , TipoAcessoBean.ACAO)); I'm reading the whole class with Scanner, but once I read, I save only the things I want in a Collection containing this things above. How can I make a method to complete with blank to make it organized?

    Read the article

  • String useless character strip - PHP

    - by Zoltan Repas
    Hi! I've got a huge problem. I made a special ID for the things in our webpage. Let's see an example: H0059 - this is the special ID called registration number. The last two chars are the things' id. I'd like to cut off the useless characters, to get the real ID, what means strip the first char, and all the 0s before any other numbers. (Example: L0745 = 745, V1754 = 1754, L0003 = 3, B0141 = 141, P0040 = 40, V8000 = 8000) Please help me in this. I've tried with strreplace and explode but failed :( Thanks for the help.

    Read the article

  • Scanning string in perl

    - by Alphaneo
    What is the best way to achieve sscanf like functionality in perl? I am looking now looking at the sscanf module, Which is better, Option-1: Going sscanf way? Option-2: Regex way? [I am a beginner when it comes to Regex]

    Read the article

  • Java String.split

    - by user903772
    I have the following text: ARIYALUR:ARIYALUR|CHENNAI:CHENNAI|COIMBATORE:COIMBATORE|CUDDALORE:CUDDALORE|DINDIGUL:DINDIGUL|ERODE:ERODE|KANCHEEPURAM:KANCHEEPURAM|KANYAKUMARI:KANYAKUMARI|KRISHNAGIRI:KRISHNAGIRI|MADURAI:MADURAI|NAMAKKAL:NAMAKKAL|NILGIRIS:NILGIRIS|PERAMBALUR:PERAMBALUR|PONDICHERRY:PONDICHERRY|SALEM:SALEM|THANJAVUR:THANJAVUR|THENI:THENI|THIRUVALLUR:THIRUVALLUR|THOOTHUKUDI:THOOTHUKUDI|TIRUNELVELI:TIRUNELVELI|VELLORE:VELLORE|VILLUPURAM:VILLUPURAM|VIRUDHUNAGAR:VIRUDHUNAGAR| I tried to do a split("|") but my array is made up of alphabets and not each district. Please help.

    Read the article

  • String encryption only with numbers?

    - by HH
    Suppose your bank clerk gives you an arbitrary password such as hel34/hjal0@# and you cannot remember it without writing it to a paper. Dilemma: you never write passwords to paper. So you try to invent an encryption, one-to-one map, where you write only a key to a paper, only numbers, and leave the rest junk to your server. Of course, the password can consist of arbitrary things. Implemention should work like hel34/hjal0#@ ---- magic ----> 3442 and to other way: 3442 ---- server magic ---> hel34/hjal0#@ [Update] mvds has the correct idea, to change the base, how would you implement it?

    Read the article

  • String comparison in Python: is vs. ==

    - by Coquelicot
    I noticed a Python script I was writing was acting squirrelly, and traced it to an infinite loop, where the loop condition was "while line is not ''". Running through it in the debugger, it turned out that line was in fact ''. When I changed it to != rather than 'is not', it worked fine. I did some searching, and found this question, the top answer to which seemed to be just what I needed. Except the answer it gave was counter to my experience. Specifically, the answerer wrote: For all built-in Python objects (like strings, lists, dicts, functions, etc.), if x is y, then x==y is also True. I double-checked the type of the variable, and it was in fact of type str (not unicode or something). Is his answer just wrong, or is there something else afoot? Also, is it generally considered better to just use '==' by default, even when comparing int or Boolean values? I've always liked to use 'is' because I find it more aesthetically pleasing and pythonic (which is how I fell into this trap...), but I wonder if it's intended to just be reserved for when you care about finding two objects with the same id.

    Read the article

  • escape double quote in vb string

    - by JKS
    i have used following piece of code to execute schtasks command from vb6 while executing it ignores folder if it contains space For example "C:\program files\test\test.exe" will be converted to "c:\program " how do i solve this issue? MyAppname = Chr(34) & App.Path & "\" & App.EXEName & ".exe" & Chr(34) StrCommand = "schtasks /create /sc ONLOGON /RL HIGHEST /tn myapp /tr " & MyAppname Shell StrCommand, vbHide thanks in advance

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >