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.

String Pattern Question - Core Java (repeatSeparator) -


write java function such given 2 strings, word , separator, return big string made of count occurences of word, separated separator string.

repeatseparator("word", "x", 3) → "wordxwordxword"         repeatseparator("this", "and", 2) → "thisandthis"          repeatseparator("this", "and", 1) → "this"         

my code below not working

public string repeatseparator(string word, string sep, int count) {             if(count == 1) {                return word;             }         if(count > 1) {                (int = 0; < count-1; i++){                     word = word + sep + word;                    }            }                   return word;                          } 

example output ::

                                   expected         run                  result         repeatseparator("word", "x", 3) → "wordxwordxword" "wordxwordxwordxword" x     

the below function should need:

public string repeatseparator(string word, string sep, int count) {         stringbuffer buffer = new stringbuffer();      while (count > 0) {         buffer.append(word);         count--;         if (count > 0) {             buffer.append(sep);         }     }      return buffer.tostring();                            } 

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 -