w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Split string with colon (:) and separate the numbers with colon
Try string.Split string input = "D93:E93 E98 E9:E10 E26 D76:E76 D83:E83 D121:D124"; var output = input.Split(new [] {':', ' '}); Console.WriteLine(output); or if you need the commas: string input = "D93:E93 E98 E9:E10 E26 D76:E76 D83:E83 D121:D124"; var output = input.Split(new [] {':', ' '}); var outstr = output.Aggregate((a,e) => a + ", " + e); Console.WriteLine(outstr);

Categories : C#

How to replace colon and remove extra spaces?
I suppose you have to ask yourself, what is more important: readability, or time consumption? A single regex would be quicker, but far less readable (in my opinion). If you're using this on smaller bodies of strings, I doubt the cost difference is going to be significant at all, but on larger strings, and where time is of the upmost importance, perhaps it is worth considering the single regex. I'd still suggest that it's unlikely to be the case (given this exact example), and so in general I'd advise you to stick with your original code. @luk2302's single regex solution works perfectly, so if you must go for a single solution, then go with that. Initially I actually thought that a single more-complex regex would take longer to load than a single string replace followed by a single simple

Categories : Jquery

Search and replace colon (:) between double quotes using regular expressions
Here is what I did (thanks for all the help @Mike, but I had to make many edits. That's why I am answering my own question so other users can get the complete answer) Search for "text": ".*? : .*?", in Notepad++ Find and replace with 1~2 to replace all : with ~ Manually correct the mistakes

Categories : Regex

Regex to find a string after the last colon
You need no regex for this: String yourString = "<210> DW_AT_name : (indirect string, offset: 0x55): double"; String result; if (yourString.contains("DW_AT_name")) { int lastIndex = yourString.lastIndexOf(":"); result = yourString.substring(lastIndex + 1).trim(); } else { result = "ERROR"; // or handle this however you want } System.out.println(result); Simply find the last : and take everything after that. Then trim it to remove leading and trailing whitespace. I edited my question, it needs to also check for DW_AT_name. String split wont [sic] do that. Just use contains, then. (edited answer)

Categories : Java

SSH find and replace string in a list of filenames
Assuming you get an interactive shell when you ssh into your linux server, this might be a possible way: ssh user@machine-name-or-ip then you will get some sort of terminal like user@machine-name:~$ where you enter the commands to execute on that remote machine. As mentioned in the comments, the answer here might just fit very well: Bash: Rename small part of multiple files in middle of name user@machine-name:~$ for i in *.mp3; do mv "$i" "$(echo "$i" | sed 's/_oldDomainName/_NEWDomainName/g')"; done This assumes, your current directory is the one with all the MP3 files in it. If you dont want interactivly operate on your files, e.g. because they change very often and you want a script to perform this action, SSH can also execute a command and/or shell script remotely. To pass

Categories : Linux

C# XML 'colon' in root name possible?
The "site:" bit with the colon in is actually your XML Namespace, set this property instead. Look at this question: How to create XmlElement attributes with prefix?

Categories : C#

Regex before a colon
If you wan't to find word (\w+) between &[ and : then you can use look-around mechanisms (?<=&\[)\w+(?=:)

Categories : Java

DateTimeFormat with Timezone and no colon
Function format-dateTime() looks for current-dateTime() format which needs colon between time zone HH:MM, in your case it is missing (0230). You should use another method to put colon between them: let $x:= "2013-02-13T16:49:51.733+0230" return concat(substring-before($x,'+'),'+',substring(substring-after($x,'+'),1,2),':',substring(substring-after($x,'+'),3,2)) output: 2013-02-13T16:49:51.733+02:30

Categories : String

In C# what category does the colon " : " fall into, and what does it really mean?
Colons are used in seven fundamentally different places (that I can think of, with the help of everyone in the comments): Separating a class name from from it's base class / interface implementations in class definitions or in generic constraint definitions. public class Foo : Bar { } public class Foo<T> where T : Bar { } public void Foo<T>() where T : Bar { } Indicating how to call the another constructor on the current class or a base class's constructor prior to the current constructor. public Foo() : base() { } public Foo(int bar) : this() { } Specifying the global namespace (as C. Lang points out, this is the namespace alias qualifier) global::System.Console Specifying attribute targets [assembly: AssemblyVersion("1.0.0.0")] Specifying parameter names Consol

Categories : C#

Parsing xml with colon using libxml
A colon within element names is not just a regular character -- it defines a XML namespace. A namespace must be declared in order to be used - like: <root xmlns:PropertyList='http://www.example.org/schema'> A probable issue with your document is that it doesn't declare the used namespaces, which results in a parsing error.

Categories : C++

PHP Parse XML with colon in tag name using children
First of all, you're using an undefined variable in your foreach loop. You've defined $clipinfo but you're trying to use $clipartinfo in your code. Second, you're accessing the attributes incorrectly: <media:thumbnail url="http://openclipart.org/image/foo.png"/> You're trying to access the URL attribute. This needs to be done with attributes() method. Change: $thumb=$clipartinfo->children('media', true)->thumbnail['url']; to: $thumb = $clipinfo->children('media', true)->thumbnail->attributes()->url; Hope this helps!

Categories : PHP

How to align colon vertically using css?
You'll need to use elements that have display:inline-block then you can use vertical-align:middle EDIT I misunderstood the question. You could set a minimum width on your <b> tags, but it's not fully cross-browser: <style> p b { min-width: 50px; display:inline-block; } </style> <p><b>Foo</b>:</p> <p><b>Bar</b>:</p> However, as you're using a table anyway, I'd suggest using the table itself to keep things aligned

Categories : HTML

Parse JSON with colon in key
You could write your own parser and just parse the json as a string, there you can add custom parsing features to the id field. Although being in java, this might help

Categories : Python

Add namespace with colon to xml file
Try This XNamespace ns = XNamespace.Get("http://namespace"); var xDocument = new XDocument( new XElement(ns + "Root", new XAttribute(XNamespace.Xmlns + "ns0", ns), new XElement("Node1", new XElement("A", "ValueA"), new XElement("B", "ValueB") )));

Categories : C#

What does the colon : mean in x86 assembly GAS syntax as in %ds:(%bx)?
In real mode, the segment register is used to provide a 20-bit address. In this case, the data segment register ds provides the 'high' 16 bits of the address: (0x1234 << 4 = 0x12340), and the offset in the segment is given by: 0x5678, to yield: 0x179b8. The data segment register is implicit, so it's not necessary to use: ds:(%bx). If you were using another segment register, like es, it would need to be explicit. I hope I've understood your question. As to why it's not written as (%ds:%bx), that's really just a syntactic decision that you're stuck with.

Categories : Assembly

Python ConfigParser with colon in the key
Split out your URL protocol, base and the port, i.e. the bits after the : and use them as a secondary keys OR Replace : with something allowed and vice-versa, possibly using a 0xnn notation or something similar OR You could use a value based on the URL such as a MD5 of the URL value as your key.

Categories : Python

Get all letters before the optional colon
Try: preg_replace("/^([A-Z]+).*$/", "$1", $cell) It'll 'save' the first part and remove everything else. regex101 demo.

Categories : PHP

Match text after colon
If you're doing this in C# and using the included Regex engine, your original regex should work, with a slight modification: string myString = "type : something"; var match = Regex.Match(myString, @"(?<=types*:s*)w+"); Console.Write(match); Edit: The reason why the ?<=types*:s*)w* version wasn't working for you with multiple spaces, is because the regex match was happily returning various combinations of strings with 0 characters after the variable number of spaces following the colon. You can view the various matched strings by using Regex.Matches, you'll see that your matched word is in there, but it's not the first result.

Categories : C#

Assembly, the meaning behind the colon ":"
Those are memory addresses expressed in the segment:offset scheme. See e.g. http://thestarman.pcministry.com/asm/debug/Segments.html

Categories : Assembly

how should I do to match uppercase words also containing colon
You must add the colon in your character class. or just before the closing parenthesis of you capturing group (with a question mark if you want it optional). $str = preg_replace('~[A-Z]{2,}(?:s[A-Z]{2,})?:?~', '<b>$0</b>', $str); Notice: word boundaries are not needed here, since the regex engine begin from the left and your quantifier {2,} is greedy)

Categories : PHP

XSLT: Colon in attribute name in source XML
Please read about XML Namespaces, a good starting point can be XML Namespaces tutorial on w3schools.com to know about the usage of "colons". You could read the MSDN article about XML Namespaces and How They Affect XPath and XSLT to know more.

Categories : Android

a right-associative triple colon operator
From the docs: def :::(prefix: List[A]): List[A] [use case] Adds the elements of a given list in front of this list. Example: List(1, 2) ::: List(3, 4) = List(3, 4).:::(List(1, 2)) = List(1, 2, 3, 4) prefix - The list elements to prepend. returns - a list resulting from the concatenation of the given list prefix and this list. This says it all. As for the right-associative operations, your r right.

Categories : Scala

Python: Insert string (colon) in between HEX
The answer to your question is here: Pythonic way to insert every 2 elements in a string You could also use a step i.e. str[::x] to loop over every 2 characters to achieve this result. myStr = 'AABBCCDDEEFF112233' print ':'.join(myStr[i:i+2] for i in range(0, len(myStr), 2))

Categories : Python

Get lines which don't end with semi-colon from a file
I think the easiest way would be with grep. Given an input.txt file like this: spam foo;<Space><Space> sausage baked;<Tab> beans unladen; You could do grep -v ';s*$' input.txt and obtain spam sausage beans grep's -v flag means "return all lines not matching this regular expression", so it will skip all lines ending with semi-colons. If your lines have also spaces after the semi-colons, the s* means "any sequence of space characters" so grep will remove those lines aswell.

Categories : Bash

BigInteger to Hexadecimal colon notation
You can insert colons after each group of two digits with a simple regex, like this: String res = orig.replaceAll("(?<=..)(..)", ":$1") This expression matches groups of two characters, and inserts a colon in front of each group except the first one. Here is a demo on ideone.

Categories : Java

Java semi-colon issue
this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + (" Has Been Enabled!"); should be this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has Been Enabled!"); You have an extra starting bracket at which needs to be removed (" Has Been Enabled!") ^^^ //Above causing error

Categories : Java

C++ colon syntax with function body
The XXX: is a label. It doesn't serve any functional purpose in the code you posted. It may have been put in by the author to help them organize the code. You can use labels with goto statements, as in goto XXX; to jump to that point in your code, although I'll leave it up to you to decide if that is a good think or now.

Categories : C++

Highlighting keywords beginning with colon in Vim
From :h :syn-define about keywords... It can only contain keyword characters, according to the 'iskeyword' option. It cannot contain other syntax items. It will only match with a complete word (there are no keyword characters before or after the match). The keyword "if" would match in "if(a=b)", but not in "ifdef x", because "(" is not a keyword character and "d" is. That means you'll have to modify iskeyword for your file type to include the colon character (ascii 58). Starting from the vi default, we can support any alphabetic character, number, underscore, or colon: set iskeyword="@,48-58,_"

Categories : Vim

alternative to javascript: when colon is filtered
To answer your question literally, if only <, >, :, % and quotes are filtered then you can still do javascript&#58; http://jsfiddle.net/zaN9m/ Please don't take this as a hint to just add this extra character. This is exactly the game where you are always one step behind. And you will not be able to allow harmless input if you do the "filter all bad chars out" thing, so yeah. Consider what happens when you start looking out for &#58; and I pass javascript:&:#:5:8:;. The filter will not detect &#58; there but will remove the colons and the result will be javascript&#58; after colons are filtered out and it's again a checkmate. What you want to do is to see if the URL has a scheme and match it against known good schemes like http and https. You will then also

Categories : Javascript

JSLint Missing Semi-colon
In the callback, after the function addClass() the semicolon is missing: $('.animation1').delay(350) .queue(function(){ $(this).addClass("animate-from-top"); // semicolon missing here -----------------------------^ });

Categories : Javascript

Adding Simple XML Element with PHP that has a Colon
In addition to the namespace prefix (the part before the colon), you must also include the corresponding namespace URI (as the third argument): $record_xml->addAttribute( 'xsi:schemaLocation', 'http://abc.com file:///somepath/somename.xsd', 'http://www.w3.org/2001/XMLSchema-instance' );

Categories : PHP

PHP prepared statement - what are parameter colon's used for?
Colons are required in the SQL statement, to indicate which identifiers are placeholders. Colons in the execute() or bindParam() calls are optional. The documentation specifies them, but the implementation is clever enough to figure out what you mean if you leave them out (what else could you mean?).

Categories : PHP

Why does perl translate a tick into a colon?
Read perlmod. The very second paragraph. And no, there's no way to turn it off, at least for now. Theoretically, someone could write a no feature pragma for it, but it's been that way for 20 years without causing too many problems...

Categories : Perl

git Parameters: Colon vs. Forward Slash
The : in a refspec separates the source and destination for references: The format of the refspec is an optional +, followed by <src>:<dst>, where <src> is the pattern for references on the remote side and <dst> is where those references will be written locally. The + tells Git to update the reference even if it isn’t a fast-forward. http://git-scm.com/book/ch9-5.html The / is a standard path separator (in this case, the branch dev from the remote upstream)

Categories : GIT

Regular expression to match colon
If you only want to handle that specific type of format (i.e. "public partial class 'classname'"). Something like this would do it: class Program { static readonly Regex re = new Regex( @"^public partial class[^:]+$", RegexOptions.Compiled ); static string Replacement( string stringToReplace ) { return re.Replace( stringToReplace, match => match.Value + ": IEntity" ); } static void Main() { string newString = Replacement( "public partial class Client" ); Console.WriteLine( newString ); //output: "public partial class Client: IEntity" newString = Replacement( "public partial class Server" ); Console.WriteLine( newString ); //output: "public partial class Server: IEntity" newString = Replacement( "

Categories : C#

Ruby on Rails: colon on terminal
You can think of the colon as a namespace. Somewhere within Rails there is a rake task file that looks similar to this: namespace db task :migrate do... .... end end It's a way to group related tasks together and prevent them from colliding with other tasks. This way you could potentially have devise:migrate, db:migrate, foobar:migrate, etc.

Categories : Ruby On Rails

Qt QUrl: doesn't url-encode colon
Pretty sure you want QUrl::setEncodedURL and QUrl::toEncoded http://harmattan-dev.nokia.com/docs/platform-api-reference/xml/daily-docs/libqt4/qurl.html Which version of Qt are you using? IIRC Qt 3 used QUrl:encode

Categories : C++

how to get value of url parameter with colon in text in django
Your regular expression allows only digits. d doesn't match :. If your view function is able to handle the colon, broaden the pattern: url(r'^config/(?P<config_id>[d:]+)/$', views.config, name='config') Since you've named the pattern config_id I suspect it's a primary key, and this will not work with the view, but that depends on the view itself.

Categories : Regex

PHP str_replace replace space with dash, but too many dash
You can use the more powerful preg_replace, instructing it to replace runs of dashes and/or spaces with a single dash: $name = preg_replace('/[s-]+/', '-', $name); [s-]+ is a regular expression that matches "one or more of: whitespace and dashes".

Categories : PHP

regex capture bind parameters following a colon
You just need a "look behind": (?<=:)w+ A look behind asserts, but does not capture, what comes before the match. Note the the whole match (not group 1 as in your regex) is your target. Also notice the simplification: w means exactly [a-zA-Z0-9_] . See this regex running on rubular

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.