Search Results

Search found 860 results on 35 pages for 'strip'.

Page 3/35 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • how to strip namespaces with e4x?

    - by SorcyCat
    I have an arbitrary XML document provided by a URL. I also have an xpath-like expressions. var xml = <doc><node1><node2><node3>some value</node3></node2></node1></doc>; var path = "node1.node2.node3"; I need to verify if the above path into the XML is valid. I tried to do this using eval and E4X. var value = eval("xml."+path); However, my actual xml document has namespaces which are getting in the way. I do not know the namespaces ahead of time or care what they are. Is there a way to strip all the namespaces out ahead of time? Is there a better way to do this? Thanks!

    Read the article

  • How to Split and strip into multiple variables?

    - by Khou
    How to Split and strip X string values into separate variables? X has string value of itemA=myvalue&itemB=anothervalue&itemC=andanother I have 3 strings (var1,var2,var3) to hold the values of the stripped values. Find in string X "itemA=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var1) Find in string X "itemB=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var2) Find in string X "itemB=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var3)

    Read the article

  • Strip All Urls From A Mixed String ( php )

    - by Axel
    Hi, i reposted this question because i didn't find a good answer. i have a string which can contains text with urls. i want a function to strip all urls from this string and just let the text. by example the string can contains like this : 1) hey take a look here : http://xxx.xxx/545df5 this is nice! 2) hey take a look here : http://www.xxx.xxx/545df5 this is nice! 3) hey take a look here : xxx.xxx/545df5 this is nice! 4) hey take a look here : www.xxx.xxx/545df5 this is nice! Thanks

    Read the article

  • Strip text of all formatting on paste

    - by griegs
    I have an application that allows the user to create an article. The problem arises when the user pastes from something like Word which comes loaded with a bunch of markup. I'm using a jQuery editor called tiny_mce which allows the markup. I do a htmlencode and decode obviously but it means that i carry a huge payload of markup. Is there a way to strip (all) markup from pasted text and just keep the text? Or is there a way that tiny_mce can show the markup as text?

    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

  • Windows7 explorer context strip hook?

    - by aceman
    Hy everybody, I'm wondering if it's possible to add a new button via C++ or C# to windows 7 explorer "context strip"(don't know if this is correct name) - like on picture below. My reason for this is because a lot of times I'm switching on&off "Show hidden files, folders and drives" functionality under Tools-Folder option-View. Therefore i want to simplify this process with a click of a button. I was looking into ShellExecteEx function, but I am not sure I can do that. Can Anybody direct me in right direction? thanks, regards

    Read the article

  • strip version from package name using Bash

    - by cd1
    hi, I'm trying to strip the version out of a package name using only Bash. I have one solution but I don't think that's the best one available, so I'd like to know if there's a better way to do it. by better I mean cleaner, easier to understand. suppose I have the string "my-program-1.0" and I want only "my-program". my current solution is: #!/bin/bash PROGRAM_FULL="my-program-1.0" INDEX_OF_LAST_CHARACTER=`awk '{print match($0, "[A-Za-z0-9]-[0-9]")} <<< $PROGRAM_FULL` PROGRAM_NAME=`cut -c -$INDEX_OF_LAST_CHARACTER <<< $PROGRAM_FULL` actually, the "package name" syntax is an RPM file name, if it matters. thanks!

    Read the article

  • Only strip commas surrounded by numbers in a string

    - by overlook77
    I am using StreamReader to read each line of a CSV file into a string. As I am processing each line, I need to strip out any commas that ONLY are surrounded by other numbers. For example, if the string was: "textfield1", "textfield2", "100.00", "1,070.00" I would need to only take the comma out of "1,070.00" from this entire string, resulting in: "textfield1", "textfield2", "100.00", "1070.00" Each string read from the CSV file can differ in number of fields, length, etc., so I need to use something (Regular Expressions maybe?) that looks at the entire string without hardcoding a location or blanket removal of all commas. Here is the approach I have been trying: StreamReader sr = new StreamReader(strInputFile); string nextLine = sr.ReadLine(); try { while ((nextLine = sr.ReadLine()) != null) { string rawtext = nextLine.Replace("[0-9]"+","+"[0-9]" , "[0-9]"+"[0-9]"); // ....rest of code } } This obviously doesn't work because I don't understand how to do this :) I am new at C# and inexperienced in Regex, so hopefully this is relatively simple.

    Read the article

  • Strip parity bits in C from 8 bits of data followed by 1 parity bit

    - by dubnde
    I have a buffer of bits with 8 bits of data followed by 1 parity bit. This pattern repeats itself. The buffer is currently stored as an array of octets. Example (p are parity bits): 0001 0001 p000 0100 0p00 0001 00p01 1100 ... should become 0001 0001 0000 1000 0000 0100 0111 00 ... Basically, I need to strip of every ninth bit to just obtain the data bits. How can I achieve this? This is related to another question asked here sometime back. This is on a 32 bit machine so the solution to the related question may not be applicable. The maximum possible number of bits is 45 i.e. 5 data octets This is what I have tried so far. I have created a "boolean" array and added the bits into the array based on the the bitset of the octet. I then look at every ninth index of the array and through it away. Then move the remaining array down one index. Then I've got only the data bits left. I was thinking there may be better ways of doing this.

    Read the article

  • Rails - strip xml import from whitespace and line break

    - by val_to_many
    Hey folks, I am stuck with something quite simple but really annoying: I have an xml file with one node, where the content includes line breaks and whitspaces. Sadly I can't change the xml. <?xml version="1.0" encoding="utf-8" ?> <ProductFeed> ACME Ltd. Fooproduct Foo Root :: Bar Category I get to the node and can read from it without trouble: url = "http://feeds.somefeed/feed.xml.gz" @source = open((url), :http_basic_authentication=>["USER", "PW"]) @gz = Zlib::GzipReader.new(@source) @result = @gz.read @doc = Nokogiri::XML(@result) @doc.xpath("/ProductFeed/Vendors/Vendor").each do |manuf| vendor = manuf.css("Name").first.text manuf.xpath("//child::Product").each do |product| product_name = product.css("Name").text foocat = product.css("Category").text puts "#{vendor} ---- #{product_name} ---- #{foocat} " end end This results in: ACME Ltd. ---- Fooproduct ---- Foo Root :: Bar Category Obviously there are line breaks and tab stops or spaces in the string returned by product.css("Category").text. Does anyone know how to strip the result from linebreaks and taps or spaces right here? Alternatively I could do that in the next step, where I do a find on 'foocat' like barcat = Category.find_by_foocat(foocat) Thanks for helping! Val

    Read the article

  • RegEx strip html tags problem

    - by Aleksandar Mirilovic
    Hi, I've tried to strip html tags using regex replace with pattern "<[^]*" from word generated html that looks like this: <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=iso-8859-2"> <meta name=Generator content="Microsoft Word 11 (filtered medium)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place" downloadurl="http://www.5iantlavalamp.com/"/> <!--[if !mso]> <style> st1\:*{behavior:url(#default#ieooui) } </style> <![endif]--> <style> <!-- /* Font Definitions / @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} / Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal; font-family:Arial; color:windowtext;} span.EmailStyle18 {mso-style-type:personal-reply; font-family:Arial; color:navy;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style> </head> Everything works fine except for the bolded lines above, anybody got ideas how to match the them to? Thanks, Aleksandar

    Read the article

  • Delphi 2009 - Strip non alpha numeric from string

    - by Brad
    I've got the following code, and need to strip all non alpha numeric characters. It's not working in delphi 2009 ` unit Unit2; //Used information from // http://stackoverflow.com/questions/574603/what-is-the-fastest-way-of-stripping-non-alphanumeric-characters-from-a-string-in interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; Type TExplodeArray = Array Of String; TForm2 = class(TForm) Memo1: TMemo; ListBox1: TListBox; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } Function Explode ( Const cSeparator, vString : String ) : TExplodeArray; Function Implode ( Const cSeparator : String; Const cArray : TExplodeArray ) : String; Function StripHTML ( S : String ) : String; function allwords(data:string):integer; end; var Form2: TForm2; allword, allphrase: TExplodeArray; implementation {$R *.dfm} Function TForm2.StripHTML ( S : String ) : String; Var TagBegin, TagEnd, TagLength : Integer; Begin TagBegin := Pos ( '<', S ); // search position of first < While ( TagBegin > 0 ) Do Begin // while there is a < in S TagEnd := Pos ( '>', S ); // find the matching > TagLength := TagEnd - TagBegin + 1; Delete ( S, TagBegin, TagLength ); // delete the tag TagBegin := Pos ( '<', S ); // search for next < End; Result := S; // give the result End; Function TForm2.Implode ( Const cSeparator : String; Const cArray : TExplodeArray ) : String; Var i : Integer; Begin Result := ''; For i := 0 To Length ( cArray ) - 1 Do Begin Result := Result + cSeparator + cArray [i]; End; System.Delete ( Result, 1, Length ( cSeparator ) ); End; Function TForm2.Explode ( Const cSeparator, vString : String ) : TExplodeArray; Var i : Integer; S : String; Begin S := vString; SetLength ( Result, 0 ); i := 0; While Pos ( cSeparator, S ) 0 Do Begin SetLength ( Result, Length ( Result ) + 1 ); Result[i] := Copy ( S, 1, Pos ( cSeparator, S ) - 1 ); Inc ( i ); S := Copy ( S, Pos ( cSeparator, S ) + Length ( cSeparator ), Length ( S ) ); End; SetLength ( Result, Length ( Result ) + 1 ); Result[i] := Copy ( S, 1, Length ( S ) ); End; //Copied from JclStrings function StrKeepChars(const S: AnsiString; const Chars: TSysCharSet): AnsiString; var Source, Dest: PChar; begin SetLength(Result, Length(S)); UniqueString(Result); Source := PChar(S); Dest := PChar(Result); while (Source < nil) and (Source^ < #0) do begin if Source^ in Chars then begin Dest^ := Source^; Inc(Dest); end; Inc(Source); end; SetLength(Result, (Longint(Dest) - Longint(PChar(Result))) div SizeOf(AnsiChar)); end; function ReplaceNewlines(const AValue: string): string; var SrcPtr, DestPtr: PChar; begin SrcPtr := PChar(AValue); SetLength(Result, Length(AValue)); DestPtr := PChar(Result); while SrcPtr < {greater than less than} #0 do begin if (SrcPtr[0] = #13) and (SrcPtr[1] = #10) then begin DestPtr[0] := '\'; DestPtr[1] := 't'; Inc(SrcPtr); Inc(DestPtr); end else DestPtr[0] := SrcPtr[0]; Inc(SrcPtr); Inc(DestPtr); end; SetLength(Result, DestPtr - PChar(Result)); end; function StripNonAlphaNumeric(const AValue: string): string; var SrcPtr, DestPtr: PChar; begin SrcPtr := PChar(AValue); SetLength(Result, Length(AValue)); DestPtr := PChar(Result); while SrcPtr < #0 do begin if SrcPtr[0] in ['a'..'z', 'A'..'Z', '0'..'9'] then begin DestPtr[0] := SrcPtr[0]; Inc(DestPtr); end; Inc(SrcPtr); end; SetLength(Result, DestPtr - PChar(Result)); end; function TForm2.allwords(data:string):integer; var i:integer; begin listbox1.Items.add(data); data:= StripHTML ( data ); listbox1.Items.add(data); ////////////////////////////////////////////////////////////// data := StrKeepChars(data, ['A'..'Z', 'a'..'z', '0'..'9']); // Strips out everything data comes back blank in Delphi 2009 ////////////////////////////////////////////////////////////// listbox1.Items.add(data); data := stringreplace(data,' ',' ', [rfReplaceAll, rfIgnoreCase] ); //Replace two spaces with one. listbox1.Items.add(data); allword:= explode(' ',data); { // Converting the following PHP code to Delphi $text = ereg_replace("[^[:alnum:]]", " ", $text); while(strpos($text,' ')!==false) $text = ereg_replace(" ", " ", $text); $text=$string=strtolower($text); $text=explode(" ",$text); return count($text); } for I := 0 to Length(allword) - 1 do listbox1.Items.Add(allword[i]); end; procedure TForm2.Button1Click(Sender: TObject); begin //[^[:alnum:]] allwords(memo1.Text); end; end. ` How else would I go about doing this? Thanks

    Read the article

  • strip extra quotes from html using uTidy

    - by mridang
    Hi, Could anyone tell me how I could remove extra-quotes from my HTML using uTidy. The malformed HTML tag looks like this: <th align="left""> <input type="submit" style="font-weight: bold;" value="Go"> </th> I would also like to remove some empty attributes in the HTML that looks like this (notice the alt tag): <img src="http://static.foobar.org/images/blank.gif" width="1" height="1" alt="" border="0"> Thank you.

    Read the article

  • strip all <img> tags within a div

    - by Andrew Welch
    Hi, I have a jcycle plugin on a number of divs which are testimonials. Basically I don't want to show the tag in the testimonial viewed in a block on the front page but rather I do want it to show on another page. So I want to add some jquery or another method that strips the img tags for the front page display. Any ideas how to do this? Thanks Andy

    Read the article

  • Java (Android) regular expression to strip out HTML paragraph

    - by jackbot
    I have an Android application which grabs some data from an external XML source. I've stripped out some HTML from one of the XML elements, but it's in the format: <p class="x">Some text...</p> <p>Some more text</p> <p>Some final text</p> I want to extract the middle paragraph text, how can I do this? Would a regular expression be the best way? I don't really want to start including external HTML parsing libraries.

    Read the article

  • Strip out C Style Multi-line Comments

    - by Olaseni
    I have a C# string object that contains the code of a generic method, preceded by some standard C-Style multi-line comments. I figured I could use System.Text.RegularExpressions to remove the comment block, but I can seem to be able to get it to work. I tried: code = Regex.Replace(code,@"/\*.*?\*/",""); Can I be pointed in the right direction?

    Read the article

  • How to strip a GET property from the URL using PHP

    - by James
    I have the following function that get's the current page URL: <?php // get current page url function currentPageUrl() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } echo $pageURL; } ?> Which prints: http://localhost/gallery.php?id=23&type=main I want to remove "&type=main" which is present in the url. So before echoing $pageURL I add the following line: $pageUrl = preg_replace("&type=main", "", $pageURL); But it still returns the full url including type=main. How can I get rid of that from the url?

    Read the article

  • JavaScript To Strip Page For URL

    - by Russell C.
    We have a javascript function we use to track page stats internally. However, the URLs it reports many times include the page numbers for search results pages which we would rather not be reported. The pages that are reports are of the form: http://www.test.com/directory1/2 http://www.test.com/directory1/subdirectory1/15 http://www.test.com/directory3/1113 Instead we'd like the above reported as: http://www.test.com/directory1 http://www.test.com/directory1/subdirectory1 http://www.test.com/directory3 Please note that the numbered 'directory' and 'subdirectory' names above are just for example purposes and that the actual subdirectory names are all different, don't necessarily include numbers at the end of the directory name, and can be many levels deep. Currently our JavaScript function produces these URLs using the code: var page = location.hostname+document.location.pathname; I believe we need to use the JavaScript replace function in combination with some regex but I'm at a complete loss as to what that would look like. Any help would be much appreciated! Thanks in advance!

    Read the article

  • Strip text except from the contents of a tag

    - by myle
    The opposite may be achieved using pyparsing as follows: from pyparsing import Suppress, replaceWith, makeHTMLTags, SkipTo #... removeText = replaceWith("") scriptOpen, scriptClose = makeHTMLTags("script") scriptBody = scriptOpen + SkipTo(scriptClose) + scriptClose scriptBody.setParseAction(removeText) data = (scriptBody).transformString(data) How could I keep the contents of the tag "table"?

    Read the article

  • Perl Strip Comments with Regex Unique Request

    - by YoDar
    Hello, I'm running a code that read files, do some parsing but need to ignore all comments. There are good explanations how to conduct it. like this link $/ = undef; $_ = <>; s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $2 ? $2 : ""#gse; print; My first problem is that after run this line $/ = undef; my code doesn't work properly. Actually, I don't know what it does. But if I could turn it back after ignoring all comments it will be helpful. In general, What is the useful way to ignore all comments without changing the rest of the code ? Thanks, YoDar

    Read the article

  • how can i strip formatting from word document using php

    - by shazia
    I want to display a word file and then extract the content and display it in a separate textarea. i want to do away with the formatting as well. this is what i get when i get the read the text file using php ??????ÿÿÿÿ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????Running Head: INTERNATIONAL BUSINESS International Business [Name of the writer] [Name of the institution] International Business Question 1 Increasing returns to scale (or economies of scale) in production is an indisputable phenomenon characterizing real world production, and, as such, they have long been recognized as a principal source of economic prosperity. Nonetheless, they have never played a major role in this is the code $fh = fopen($newname, 'r'); $contents => fread($fh, filesize($newname)); fclose($fh); unlink($newname); echo "<br/>"; echo $contents; how can i get rid of all these charecters. Thanks

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >