Search Results

Search found 37183 results on 1488 pages for 'string conversion'.

Page 172/1488 | < Previous Page | 168 169 170 171 172 173 174 175 176 177 178 179  | Next Page >

  • string substitution regular expression not working in tcl

    - by Puneet Mittal
    i am trying to replace all the special characters including white space, hyphen, etc, to underscore, from a string variable in tcl. I wrote the code below but it doesn't seem to be working. set varname $origVar puts "Variable Name :>> $varname" if {$varname != ""} { regsub -all {[\s-\]\[$^?+*()|\\%&#]} $varname "_" $newVar } puts "New Variable :>> $newVar" one issue is that, instead of replacing the string in $varname, it is replacing the data inside $origVar. No idea why, and also i read the example code (for proper syntax) in my tcl book and according to that it should be something like this regsub -all {[\s-][$^?+*()|\\%&#]} $varname "_" newVar so i used the same syntax but it didn't work and gave the same result as modifying the $origVar instead of required $varname value.

    Read the article

  • Exchange Server Address Resolving to Random String

    - by William
    I am running Exchange 2013 on Windows Server 2012 R2. When I add my exchange account to Outlook, it seems to work perfectly (sending/receiving email, syncing everything), but when I open the account settings it has the following set as the Server: [email protected] I would have expects this to be: mail.domain.com since this is the DNS A record pointing to the IP of my server. Where is it getting this server name?

    Read the article

  • C++ MFC add combo box string item from a widget ID

    - by OzBarry
    I've added a combo box in the gui editor in MSVC 2010 pro in my MFC project. I have a list of strings I am grabbing from an external source and want to add them to my combo box. I've searched for a while, and every post seems to suggest I need to use the CComboBox class, however, I have no idea how to get the class variable from the resource ID of the combobox element in the gui editor. In summary, how do I add a string to my combo box, either using a macro (like CB_ADDSTRING(RESOURCE_ID, "my string");) or using CComboBOx (something like CComboBox::GetObject(RESOURCE_ID)->AddString("blah");). I do not do much win32 api/mfc programming, and just started fiddling around with it.

    Read the article

  • appending text to all files that starts with a string

    - by learner135
    How do I append a string to all the files in a directory that starts with a particular string? I tried, cat mysig >> F* But instead of appending contents of mysig to all files starting with F, it creates a file named "F*". Obviously wildcard doesn't seem to work. Any alternatives? Thanks in advance. Edit: Also how do I delete this newly created file "F*" safely?. Using rm F* would delete all the files starting with F which I wouldn't want.

    Read the article

  • Replacing elements within a string in R

    - by Maureen
    Hi, I have a row in a data frame in R that is made up of sequences of undetermined length of 0s 1s and 2s as characters. So "01", "010", "201", "102", "00012"... things like this. I'd like to find a way to determine if the last character in the string is NUMERICALLY the largest. It's important that I keep the row in the data frame as characters for other purposes. So basically I want to take substr(x, nchar(x), nchar(x)) and determine if it, as a number, is the largest of the numbers in the character string. I'm super lost as to how to do this, since I'm not all that familiar with regular expressions and I have to back and forth between treating elements as characters and numbers. Thanks in advance. ~Maureen

    Read the article

  • Index for wildcard match of end of string

    - by Anders Abel
    I have a table of phone numbers, storing the phone number as varchar(20). I have a requirement to implement searching of both entire numbers, but also on only the last part of the number, so a typical query will be: SELECT * FROM PhoneNumbers WHERE Number LIKE '%1234' How can I put an index on the Number column to make those searchs efficient? Is there a way to create an index that sorts the records on the reversed string? Another option might be to reverse the numbers before storing them, which will give queries like: SELECT * FROM PhoneNumbers WHERE ReverseNumber LIKE '4321%' However that will require all users of the database to always reverse the string. It might be solved by storing both the normal and reversed number and having the reversed number being updated by a trigger on insert/update. But that kind of solution is not very elegant. Any other suggestions?

    Read the article

  • Convert Military time to string representation

    - by RRUZ
    I have an column declarated as int (called HourMil) wich store the time in military format. i need convert this values to an formated string (HH:MM) example HourMil = 710 -> must be 07:10 HourMil = 1305 -> must be 13:05 Actually i am using this code (and works ok) for convert the column HourMil to the string representation. SELECT SUBSTRING(LEFT('0',4-LEN(CAST(HourMil AS VARCHAR)))+CAST(HourMil AS VARCHAR),1,2)+':'+SUBSTRING(LEFT('0',4-LEN(CAST(HourMil AS VARCHAR)))+CAST(HourMil AS VARCHAR),3,2) FROM MYTABLE but I think this code can be improved.

    Read the article

  • I need to pad IP addresses with Zeroes for each octet

    - by Felipe Alvarez
    Starting with a string of an unspecified length, I need to make it exactly 43 characters long (front-padded with zeroes). It is going to contain IP addresses and port numbers. Something like: ### BEFORE # Unfortunately includes ':' colon 66.35.205.123.80-137.30.123.78.52172: ### AFTER # Colon removed. # Digits padded to three (3) and five (5) # characters (for IP address and port numbers, respectively) 066.035.05.123.00080-137.030.123.078.52172 This is similar to the output produced by tcpflow. Programming in Bash. I can provide copy of script if required. If it's at all possible, it would be nice to use a bash built-in, for speed. Is printf suitable for this type of thing?

    Read the article

  • Weird parsing date string error in Android 2.0 emulator

    - by kknight
    I have a simple test code for testing SimpleDateFormat. This code works well on Eclipse and Android 1.5 emulator, but it failed at Android 2.0 emulator. Does anyone know why? Thanks. public class TemplateActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(R.string.hello); setContentView(tv); SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); String dateStr = "Mon, 17 May 2010 01:45:41 GMT"; try { Date parsed = format.parse(dateStr); Log.v("Test", parsed.toString()); } catch (ParseException pe) { Log.v("Test", "ERROR: Cannot parse \"" + dateStr + "\""); } } } Log message: V/Test( 400): ERROR: Cannot parse "Mon, 17 May 2010 01:45:41 GMT"

    Read the article

  • Reading bytes from JavaScript string

    - by Jan
    I have a string containing binary data in JS. Now I want to read, for example, an integer from it. So I get the first 4 characters, use charCodeAt, do some shifting etc. to get an integer. Problem is that strings in JS are UTF-16 (instead of ASCII) and charCodeAt often returns values higher than 256. The Mozilla reference states that "The first 128 Unicode code points are a direct match of the ASCII character encoding." (what about ASCII values 128?) How can I convert the result of charCodeAt to an ASCII value? Or is there a better way to convert a string of four characters to a 4 byte integer?

    Read the article

  • WPF: Bind DataGrid to List<String>

    - by Sam
    Funny, how sometimes the simple things bite me in the behind. I can bind a DataGrid nicely to a Collection of some arbitrary class, using a DataGridTextColumn like this: <DataGridTextColumn Header="Name" Binding="{Binding Name}"/> Now I want to bind a DataGrid to a simple Collection. So since there is no property "Name" or something like that to bind to, how do I write the binding: <DataGridTextColumn Header="Name" Binding="{Binding ???}"/> String has no Property "Value" or something like that. And if I just write {Binding } I'll end up with a one-way-binding, unable to write changes back to the Collection. Thinking about it, I think it is not possible to bind to a collection, so I do need to wrap my string into a class? Or is there a way?

    Read the article

  • How to create custom filenames in C?

    - by eSKay
    Please see this piece of code: #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int i = 0; FILE *fp; for(i = 0; i < 100; i++) { fp = fopen("/*what should go here??*/","w"); //I need to create files with names: file0.txt, file1.txt, file2.txt etc //i.e. file{i}.txt } }

    Read the article

  • Regex to replace a string in HTML but not within a link or heading

    - by Vladimir
    I am looking for a regex to replace a given string in a html page but only if the string is not a part of the tag itself or appearing as text inside a link or a heading. Examples: Looking for 'replace_me' <p>You can replace_me just fine</p> OK <a href='replace_me'>replace_me</a> no match <h3>replace_me</h3> no match <a href='/test/'><span>replace_me</span></a> no match <p style="background:url('replace_me')">replace_me<h1>replace_me</h1></p> first no match, second OK, third no match Thanks in advance!

    Read the article

  • Linux - Bash Redirect a String to a file

    - by user3502786
    I wrote a simple script that is reading the file content and incrementing a a number inside this file, then i'm holding the change using awk, when i'm trying ro redirect the new String using '' the whole string is redirected in one line and not like the original was which is 4 lines. #!/bin/bash -x # This script is for Incrementing build numbers path=/home/RND/abrodov file=tst.txt tst=`cat $path/$file` printf "this is the content of the file before incrementing: \n $tst" newexpr=`awk '/^Build Number/{$4=$4+1;}1' /home/RND/abrodov/tst.txt` printf "\n the new content \n $newexpr" echo $newexpr > $path/$file This is the original file before running the script: Major Release Number = 4 Minor Release Number = 1 Service Pack Release Number = 2 Build Number = 22 This is the content after i used the script: Major Release Number = 4 Minor Release Number = 1 Service Pack Release Number = 2 Build Number = 23 I'm trying to figure out how can i redirect the text in the original format which is 4 lines.

    Read the article

  • Passing values for multi-value parameter in SSRS query string

    - by Andy Xufuris
    I have two reports built using SSRS 2005. The first report is set to navigate to the second when a specific field is clicked. There is a multi-value parameter on the second report. I need to pass multiple values for this parameter in the URL query string when calling this report. Is there a way to pass multiple values for a parameter in the query string of a report? Or can you pass a parameter that will cause the Select All value to be selected?

    Read the article

  • Javascript Regex: how to remove string before > and including >

    - by Kim Jong Woo
    I have a string like so item[3]>something>another>more[1]>here hey>this>is>something>new . . . I would like to produce the following for each iteration indicated by each new line item[3]>something>another>more[1]>here something>another>more[1]>here another>more[1]>here more[1]>here here Another example: hey>this>is>something>new this>is>something>new is>something>new something>new new I would like a regex or some way to incrementally remove the furthest left string up to .

    Read the article

  • Stringification of a macro value

    - by SF.
    I faced a problem - I need to use a macro value both as string and as integer. #define RECORDS_PER_PAGE 10 /*... */ #define REQUEST_RECORDS \ "SELECT Fields FROM Table WHERE Conditions" \ " OFFSET %d * " #RECORDS_PER_PAGE \ " LIMIT " #RECORDS_PER_PAGE ";" char result_buffer[RECORDS_PER_PAGE][MAX_RECORD_LEN]; /* ...and some more uses of RECORDS_PER_PAGE, elsewhere... */ This fails with a message about "stray #", and even if it worked, I guess I'd get the macro names stringified, not the values. Of course I can feed the values to the final method ( "LIMIT %d ", page*RECORDS_PER_PAGE ) but it's neither pretty nor efficient. It's times like this when I wish the preprocessor didn't treat strings in a special way and would process their content just like normal code. For now, I cludged it with #define RECORDS_PER_PAGE_TXT "10" but understandably, I'm not happy about it. How to get it right?

    Read the article

  • Replacing backslashes in Python strings

    - by user323659
    I have some code to encrypt some strings in Python. Encrypted text is used as a parameter in some urls, but after encrypting, there comes backslashes in string and I cannot use single backslash in urllib2.urlopen. I cannot replace single backslash with double. For example: print cipherText '\t3-@\xab7+\xc7\x93H\xdc\xd1\x13G\xe1\xfb' print cipherText.replace('\\','\\\\') '\t3-@\xab7+\xc7\x93H\xdc\xd1\x13G\xe1\xfb' Also putting r in front of \ in replace statement did not worked. All I want to do is calling that kind of url: http://awebsite.me/main?param="\t3-@\xab7+\xc7\x93H\xdc\xd1\x13G\xe1\xfb" And also this url can be successfully called: http://awebsite.me/main?param="\\t3-@\\xab7+\\xc7\\x93H\\xdc\\xd1\\x13G\\xe1\\xfb" Any idea will be appreciated.

    Read the article

  • Why is '\x' invalid in Python?

    - by Paul McGuire
    I was experimenting with '\' characters, using '\a\b\c...' just to enumerate for myself which characters Python interprets as control characters, and to what. Here's what I found: \a - BELL \b - BACKSPACE \f - FORMFEED \n - LINEFEED \r - RETURN \t - TAB \v - VERTICAL TAB Most of the other characters I tried, '\g', '\s', etc. just evaluate to the 2-character string of a backslash and the given character. I understand this is intentional, and makes sense to me. But '\x' is a problem. When my script reaches this source line: val = "\x" I get: ValueError: invalid \x escape What is so special about '\x'? Why is it treated differently from the other non-escaped characters?

    Read the article

  • Retrieving xml value into a string

    - by DelvinK
    Hello, In the following XML structure how do i retrieve the name value and put this into a string? (i am using a XPathNavigator in my method) <testsystem> <test> <name>one</name> </test> </testsystem> I was able to get a attribute with a syntax alike this: (but when changing the xml struture it no longer holds a attribute value) string name = nav.GetAttribute("name", "") But have no luck getting the value with a nav as of yet. The purpose is to be able to use it for the following object so i can put name into it. test t = new test() { Name = name, Questions= new List<Questions>() }; Best regards.

    Read the article

< Previous Page | 168 169 170 171 172 173 174 175 176 177 178 179  | Next Page >