Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

python - nth word in a text -


how can find nth word in text.

example:

my_txt("hello all" , 3)  

i don't wanna use built in function ...and not homework :d

ok asked this. need "split words" function. here is. assumes "words" delimited whitespace.

no built-in functions, no imported anythings, no methods of built-in types, not panty-waist stuff +=. , it's tested.

c:\junk>\python15\python python 1.5.2 (#0, apr 13 1999, 10:51:12) [msc 32 bit (intel)] on win32 copyright 1991-1995 stichting mathematisch centrum, amsterdam >>> def mysplit(s): ...     words = [] ...     inword = 0 ...     c in s: ...         if c in " \r\n\t": # whitespace ...             inword = 0 ...         elif not inword: ...             words = words + [c] ...             inword = 1 ...         else: ...             words[-1] = words[-1] + c ...     return words ... >>> mysplit('') [] >>> mysplit('x') ['x'] >>> mysplit('foo') ['foo'] >>> mysplit('  foo') ['foo'] >>> mysplit('  foo    ') ['foo'] >>> mysplit('\nfoo\tbar\rzot ugh\n\n   ') ['foo', 'bar', 'zot', 'ugh'] >>> 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -