Search Results

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

Page 203/1413 | < Previous Page | 199 200 201 202 203 204 205 206 207 208 209 210  | Next Page >

  • matching certain numbers at the end of a string

    - by user697473
    I have a vector of strings: s <- c('abc1', 'abc2', 'abc3', 'abc11', 'abc12', 'abcde1', 'abcde2', 'abcde3', 'abcde11', 'abcde12', 'nonsense') I would like a regular expression to match only the strings that begin with abc and end with 3, 11, or 12. In other words, the regex has to exclude abc1 but not abc11, abc2 but not abc12, and so on. I thought that this would be easy to do with lookahead assertions, but I haven't found a way. Is there one? EDIT: Thanks to posters below for pointing out a serious ambiguity in the original post. In reality, I have many strings. They all end in digits: some in 0, some in 9, some in the digits in between. I am looking for a regex that will match all strings except those that end with a letter followed by a 1 or a 2. (The regex should also match only those strings that start with abc, but that's an easy problem.) I tried to use negative lookahead assertions to create such a regex. But I didn't have any success.

    Read the article

  • Increment number in string

    - by iform
    Hi, I am stumped... I am trying to get the following output until a certain condition is met. test_1.jpg test_2.jpg .. test_50.jpg The solution (if you could remotely call it that) that I have is fileCount = 0 while (os.path.exists(dstPath)): fileCount += 1 parts = os.path.splitext(dstPath) dstPath = "%s_%d%s" % (parts[0], fileCount, parts[1]) however...this produces the following output. test_1.jpg test_1_2.jpg test_1_2_3.jpg .....etc The Question: How do I get change the number in its current place (without appending numbers to the end)? Ps. I'm using this for a file renaming tool.

    Read the article

  • how List<string> become AutoCompleteStringCollection

    - by aeruL
    I have list, i want to convert it to autoCompleteStringCollection.. And I don't want use foreach. _textbox.AutoCompleteMode = AutoCompleteMode.Append; _textbox.AutoCompleteSource = AutoCompleteSource.CustomSource; _textbox.AutoCompleteCustomSource = user.GetNameUsers() as AutoCompleteStringCollection; Note user.GetNameUsers() is list. Code doesn't work, it become null. Thank you

    Read the article

  • Javascript How do I force a string + variable to be evaluated as a variable

    - by Craig Rinde
    Im not even sure how to word this and is probably why I am having trouble finding an answer in google. When the code is run currentCardRow will equal 1 therefore it should be cardSelected1 which is what is shown in the console.log. I need it to go a step further because cardSelected1 is a variable and I need it to evaluate show in the console log as Invitation. Invitation is an example of a variable for cardSelected1. I am not sure on what the correct syntax is to make this happen. var currentCardSelected = "cardSelected" + currentCardRow; Thanks for your help!

    Read the article

  • How to convert a string to variable name

    - by p1xelarchitect
    I'm loading several external JSON files and want to check if they have been successfully cached before the the next screen is displayed. My strategy is to check the name of the array to see if it an object. My code works perfectly when I check only a single array and hard code the array name into my function. My question is: how can i make this dynamic? not dynamic: (this works) $("document").ready(){ checkJSON("nav_items"); } function checkJSON(){ if(typeof nav_items == "object"){ // success... } } dynamic: (this doesn't work) $("document").ready(){ checkJSON("nav_items"); checkJSON("foo_items"); checkJSON("bar_items"); } function checkJSON(item){ if(typeof item == "object"){ // success... } } here is the a larger context of my code: var loadAttempts = 0; var reloadTimer = false; $("document").ready(){ checkJSON("nav_items"); } function checkJSON(item){ loadAttempts++; //if nav_items exists if(typeof nav_items == "object"){ //if a timer is running, kill it if(reloadTimer != false){ clearInterval(reloadTimer); reloadTimer = false; } console.log("found!!"); console.log(nav_items[1]); loadAttempts = 0; //reset // load next screen.... } //if nav_items does not yet exist, try 5 times, then give up! else { //set a timer if(reloadTimer == false){ reloadTimer = setInterval(function(){checkJSON(nav_items)},300); console.log(item + " not found. Attempts: " + loadAttempts ); } else { if(loadAttempts <= 5){ console.log(item + " not found. Attempts: " + loadAttempts ); } else { clearInterval(reloadTimer); reloadTimer = false; console.log("Giving up on " + item + "!!"); } } } }

    Read the article

  • PHP PDO - bindValue PARAM_BOOL as string

    - by PHP_guy
    I'm freaking out here and can't figure out what's wrong. I'm pretty new to PDO, but everything works in my code except for booleans which are sent as strings. My code (simplified): $sql = 'SELECT * FROM pages WHERE clean_url_slo = :clean_url_slo AND published = :published LIMIT 1'; $clean_url_slo = 'home'; $published = true; Then I prepare stuff and execute it like this (simplified): $stmt = $db->prepare($sql); $stmt->bindValue(':clean_url_slo',$clean_url_slo,PDO::PARAM_STR); $stmt->bindValue(':published',$published,PDO::PARAM_BOOL); $stmt->execute(); And then here is what comes to mysql (from the mysql log - the query mysql received): 91 Query SELECT * FROM pages WHERE 1=1 AND clean_url_slo='domov' AND published='1' ORDER BY id desc LIMIT 1 As you can see, published is an integer - so always true, which is not OK. Why is that if I'm declaring it as a boolean? using: WAMP SERVER PHP version: 5.3.9 Mysql: 5.5.20 Many thanks for your help..

    Read the article

  • question abouut string sort

    - by davit-datuashvili
    i have question from programming pearls problem is following show how to use lomuto's partitioning scheme to sort varying length bit strings in time proportional to the sum oof their length and algorithm is following each record in x[0..n-1] has an integer length and pointer to the array bit[0..length-1] code void bsort(l,u,depth){ if (l>=u) return; for (int i=l;i<u;i++) if (x[i].length<depth) swap(i,l++); m=l; if (x[i].bit[depth] ==0) swap(i,m++); bsort(l,m-1,depth+1); bsort(m,u,depth+1); please help me i need following things 1. how this algorith works 2.how implement in java?

    Read the article

  • preg_replace or regex string translation

    - by ccolon
    I found some partial help but cannot seem to fully accomplish what I need. I need to be able to do the following: I need an regular expression to replace any 1 to 3 character words between two words that are longer than 3 characters with a match any expression: For example: walk to the beach == walk(.*)beach If the 1 to 3 character word is not preceded by a word that's longer than 3 characters then I want to translate that 1 to 3 letter word to ' ?' For example: on the beach == on ?the ?beach The simpler the rule the better (of course, if there's an alternative more complicated version that's more performant then I'll take that as well as I eventually anticipate heavy usage eventually). This will be used in a PHP context most likely with preg_replace. Thus, if you can put it in that context then even better!

    Read the article

  • Basic string and value functions in Objective-C for iPhone

    - by David Maitland
    I have very little programming knowledge; only a fair bit in Visual Basic. How do I take a value from a text field, then do some simple math such as divide the value by two, then display it back to the user in the same field? In Visual Basic you could just do txtBoxOne.text = txtBoxOne.text / 2 I understand this question is more than one question and is very basic stuff, but I need to get my head out of Visual Basic and into where I should be :)

    Read the article

  • trying to sort a simple string in c++

    - by every_answer_gets_a_point
    #include "stdio.h" #include "conio.h" #include <iostream> using namespace std; int main (void) { char my_char[] = "happy birthday"; int i; bool j=false; char my_char_temp[1]; do { for (i=0;i<sizeof(my_char)-2;i++) { j=false; if (my_char[i+1] < my_char[i]) { my_char_temp[0]=my_char[i+1]; my_char[i+1] = my_char[i]; my_char[i] = my_char_temp[0]; j=true; } } }while (j); cout << my_char; } what am i doing wrong? im just trying to sort the letters within the char the output i get is completely wrong

    Read the article

  • @Html.Label won't allow string concatination

    - by MrGrigg
    I'm building dynamic forms based on a partial view. My view inherits a model with a single property: CatalogName { get; set; }. I have tried this: @Html.Label(Model.CatalogName + "-ProductNumber", "Product Number") @Html.TextBox(Model.CatalogName + "-ProductNumber") The HTML renders like this though: <label for>Product Number</label> <input name="CatatalogName-ProductNumber" type="text" /> If I write my code like this: @Html.Label("ProductNumber-" + Model.CatalogName", "Product Number") It will render the way I expect <label for="ProductNumber-CatalogName">Product Number</label> Is this a bug with MVC? Are there any answers to why my concatenation won't work the way I want it in the label, but works fine with the TextBox?

    Read the article

  • JQuery get element from a string problem

    - by SLC
    Sorry for such a simple question but I can't seem to find the solution. I am trying to fade in and out some divs. Divs have an ID of "div1", "div2", "div3". My code is: var Divs = new Array("div1", "div2", "div3"); I want to fade out one div and then fade in the next on top of it. I have a setinterval that runs every 5 seconds and checked it works. Inside it is this code: $(Divs[1]).fadeOut(1000); $(Divs[2]).fadeIn(1000); However nothing happens when the timer method is ran. Any ideas?

    Read the article

  • Regex get multiple segments of a string in javascript

    - by dave
    I'm trying to extract some results from a download manager, the format is: [#8760e4 4.3MiB/40MiB(10%) CN:2 DL:4.9MiB ETA:7s] what I'd like to extract from the above example, would be an array that looks like this: ['4.3','MiB','40','MiB','10%','4.9','MiB','7','s'] I've tried to split this in various combinations, but nothing seems to be right. Would anyone happen to know how to do this or be able to offer suggestions? Thank you!

    Read the article

  • C#: String.IndexOf to FileStream.Seek

    - by pistacchio
    Hi, having a FileStream that I read with a StreamReader (it is a very large file), how can I set the Seek position of the FileStream to the first occurrence of a certain substring so that I can start reading this large file from a given point? Thanks

    Read the article

  • ASP.NET MVC3 ValueProvider drops string input to a double property

    - by Daniel Koverman
    I'm attempting to validate the input of a text box which corresponds to a property of type double in my model. If the user inputs "foo" I want to know about it so I can display an error. However, the ValueProvider is dropping the value silently (no errors are added to the ModelState). In a normal submission, I fill in "2" for the text box corresponding to myDouble and submit the form. Inspecting controllerContext.HttpContext.Request.Form shows that myDouble=2, among other correct inputs. bindingContext.ValueProvider.GetValue("myDouble") == 2, as expected. The bindingContext.ModelState.Count == 6 and bindingContext.ModelState["myDouble"].Errors.Count == 0. Everything is good and the model binds as expected. Then I fill in "foo" for the text box corresponding to myDouble and submitted the form. Inspecting controllerContext.HttpContext.Request.Form shows that myDouble=foo, which is what I expected. However, bindingContext.ValueProvider.GetValue("myDouble") == null and bindingContext.ModelState.Count == 5 (The exact number isn't important, but it's one less than before). Looking at the ValueProvider, is as if myDouble was never submitted and the model binding occurs as if it wasn't. This makes it difficult to differentiate between a bad input and no input. Is this the expected behavior of ValueProvider? Is there a way to get ValueProvider to report when conversion fails without implementing a custom ValueProvider? Thanks!

    Read the article

  • Pass two string to Detail View from Search Array

    - by waqqas
    I am using a tableview with a search function and is populated by a plist. I want to pass 2 strings through to a DetailView. But I can only get the sting used to populate the cell to pass over. I have tried many variations but can't figure it out. Any help would be greatly appreciated. DetailView *nextLevel = [DetailView alloc]; NSString *valueString; NSString *selectedTitle; if (arraySearch == nil) { NSString *key = [arrayDataKeys objectAtIndex:indexPath.section]; NSArray *nameSection = [dictAllData objectForKey:key]; NSDictionary *dict = [nameSection objectAtIndex:indexPath.row]; valueString = [dict objectForKey:@"name"]; selectedTitle = [dict objectForKey:@"word"]; } else { valueString = [arraySearch objectAtIndex:indexPath.row]; **selectedTitle = [arraySearch objectAtIndex:indexPath.row];** //Obviously this is wrong but this is the line I need help with } nextLevel.title = valueString; nextLevel.itemname = valueString; nextLevel.itemWord = selectedTitle;

    Read the article

< Previous Page | 199 200 201 202 203 204 205 206 207 208 209 210  | Next Page >