I come across a problem. I defined a auto implemented string property. The data retrieval from outside source and assigned to the property. Some data having trailing spaces. Is there any possibility to trim the spaces when it is assign to the property? public string Name { get; set; }  Data retrieved from other source Name = service.GetName();   // e.g. &quot;John David   &quot;  The property will be used in several places. Instead of trim the string every places, I want to trim it when it is assigned to the property. Is it possible? Expected result Response.Write(Name) // Output:  &quot;John David&quot;    not  &quot;John David   &quot;
27924
I would like to know if there is any way to add custom behaviour to the auto property get/set methods.  An obvious case I can think of is wanting every set property method to call on any PropertyChanged event handlers as part of a System.ComponentModel.INotifyPropertyChanged implementation.  This would allow a class to have numerous properties that can be observed, where each property is defined using auto property syntax.  Basically I'm wondering if there is anything similar to either a get/set template or post get/set hook with class scope.  (I know the same end functionality can easily be achieved in slightly more verbose ways - I just hate duplication of a pattern)
115024
I have a table with a row Page_Number_N some of the rows have values and others just have a space. For example record 4 is just a space. Field values are Strings.  1 2 3  5   When I start an edit session and delete the space it deletes it. However, as soon as I save edits, the space in the data returns.  I have tried removing the space in the field calc without edit session turned on and the result is the same.  I need this record to equal "" ie. No spaces or null and I can't seem to get ArcGIS Desktop to cooperate.  Does anyone know how to fix this?
40608
Though java.util.properties allows reading and writing properties file, the writing does not preserve the formatting. Not surprising, because it is not tied to the property file.  Is there a PropertyFile class out there -- or some such -- that preserves comments and blank lines and updates property values in place?
117860
Given a struct like this:  public struct SomeStruct {     public SomeStruct(String stringProperty, Int32 intProperty)     {         this.StringProperty = stringProperty;         this.IntProperty = intProperty;     }      public String StringProperty { get; set; }     public Int32 IntProperty { get; set; } }   Of course, a compiler error is generated that reads The 'this' object cannot be used before all of its fields are assigned to.  Is there a way to assign values to the backing fields or the properties themselves, or do I have to implement properties the old-fashioned way with my own explicit backing fields?
89048
I have a problem with SQL code in a PDF document. For code representation I'm using the listings package. Everything works perfect until I copy-paste that code from the created PDF document. I get some phantom spaces in string type. When people are reading my PDF document, they need to copy-paste some of the code. Visually the code looks good in PDF, but when I try to copy-paste my code to NotePad or any other editor I get some unexpected spaces in strings. In the example below, when I copy-paste my SQL code, instead of getting:  SELECT ST_Area(the_geom)   FROM katastar   WHERE kc_broj = '1414';   I get  SELECT ST_Area(the_geom)   FROM katastar   WHERE kc_broj = ' 1414 ';   See the spaces in between quotes.  \documentclass{article} \usepackage{listings,xcolor}  \lstset{  tabsize=4,         basicstyle=\scriptsize,         %upquote=false,         aboveskip=\baselineskip,         columns=fixed,         showstringspaces=false,         extendedchars=true,         breaklines=true,         prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},  frame=single,         showtabs=false,         showspaces=false,         identifierstyle=\ttfamily,         keywordstyle=\color[rgb]{0,0,1},         commentstyle=\color[rgb]{0.133,0.545,0.133},         stringstyle=\color[rgb]{0.627,0.126,0.941},  language=SQL }  \begin{document} \begin{lstlisting} SELECT ST_Area(the_geom)   FROM katastar   WHERE kc_broj = '1414'; \end{lstlisting} \end{document}
99957
I'm trying to parse a simple string in C++.  I know the string contains some text with a colon, followed immediately by a space, then a number.  I'd like to extract just the number part of the string.  I can't just tokenize on the space (using sstream and &lt;&lt;) because the text in front of the colon may or may not have spaces in it. Some example strings might be:  Total disk space: 9852465 Free disk space: 6243863 Sectors: 4095  I'd like to use the standard library, but if you have another solution you can post that too, since others with the same question might like to see different solutions.
23076
How do I go from this string: "ThisIsMyCapsDelimitedString"  ...to this string: "This Is My Caps Delimited String"  Fewest lines of code in VB.net is preferred but C# is also welcome.  Cheers!
91805
Short prestory. Typical problem: you have a lot of small string and you want to concatenate them all in one big string. The code like for(Integer i = 0; i &lt; smallStringsSize; i++){     bigString += smallStrings[i]; }  will solve this problem, but it has to produce a lot of unnecessary string objects that consume your heap. That is why Java has classes like StringBuilder and StringBuffer that allow you to solve this problem wihtout consuming too many memory. Thus, I decided to try to do my own StringBuilder in apex. String class has two methods that looked suitable for it:   and  . Here is the code that i used to test these methods against &quot;+=&quot; concatenantion (ready to execute in anonymous): List&lt;String&gt; chars = new List&lt;String&gt;(); List&lt;Integer&gt; charsCode = new List&lt;Integer&gt;(); Integer size = 10000; String chartToAdd = 'Ω'; for(Integer i = 0; i &lt; size; i++){     chars.add(chartToAdd);     charsCode.add(String.valueOf(chartToAdd).charAt(0)); } String joinS = '', forS = '', fromS = ''; Integer initialHeapSize = Limits.getHeapSize(); Integer initialCPUtime = Limits.getCpuTime(); System.debug('initialHeapSize ' + initialHeapSize); System.debug('initialCPUtime ' + initialCPUtime); joinS = String.join(chars, ''); Integer joinHeapSize = Limits.getHeapSize() - initialHeapSize; Integer joinCPUtime = Limits.getCpuTime() - initialCPUtime; System.debug('-------- String.join ---------'); System.debug('joinHeapSize ' + joinHeapSize); System.debug('joinCPUtime ' + joinCPUtime); for(Integer i = 0; i &lt; size; i++){     forS += chars[i]; } Integer forHeapSize = Limits.getHeapSize() - joinHeapSize - initialHeapSize; Integer forCPUtime = Limits.getCpuTime() - joinCPUtime - initialCPUtime; System.debug('-------- for each += ---------'); System.debug('forHeapSize ' + forHeapSize); System.debug('forCPUtime ' + forCPUtime); fromS = String.fromCharArray(charsCode); Integer fromHeapSize = Limits.getHeapSize() - forHeapSize - joinHeapSize - initialHeapSize; Integer fromCPUtime = Limits.getCpuTime() - forCPUtime - joinCPUtime - initialCPUtime; System.debug('-------- String.fromCharArray ---------'); System.debug('fromHeapSize ' + fromHeapSize); System.debug('fromCPUtime ' + fromCPUtime); System.debug(''); System.debug('-------- strings ----------'); System.debug('joins ' + joins); System.debug('fors ' + fors); System.debug('fromS ' + fromS);  The result of this code execution:  initialHeapSize 161166 initialCPUtime 242 -------- String.join --------- joinHeapSize 10016 joinCPUtime 17 -------- for each += --------- forHeapSize 10024 forCPUtime 48 -------- String.fromCharArray --------- fromHeapSize 10016 fromCPUtime 5  As you can see, the heap size for each approach is so close to 10 kilobytes, what is a size of the string of 10 000 characters (size) if each character takes only one byte. In case of creating 10 000 additional string objects, the heap size would be a bit more than 50 megabytes (10 000 * (1 + 10 000)/2). Taking into consideration the above,  Does not the '+=' concatenation create any additional string objects that devour your heap? Did not I miss anything? I am so amazed.  As you see, I use Omega 'Ω' as a chartToAdd. It has  the high-surrogate code point equals to 937, that needs at least 2 bytes to be encoded. How can 10 000 Omegas consume only 10 000 bytes of the heap size?  What weightful reasons Salesforce has that they do not to add the character data type? Any ideas?
2047
I have a string which is like this:  this is "a test"   I'm trying to write something in Python to split it up by space while ignoring spaces within quotes. The result I'm looking for is:  ['this','is','a test']   PS. I know you are going to ask "what happens if there are quotes within the quotes, well, in my application, that will never happen.
6287
I'm doing simple string input parsing and I am in need of a string tokenizer. I am new to C# but have programmed Java, and it seems natural that C# should have a string tokenizer. Does it? Where is it? How do I use it?
35663
My controller code is as follows -          for(String resStr : responseArray){             if(resStr.indexOf('r_error_str') != -1){                 responseString += resStr.substring(resStr.indexOf('=') + 1);                  responseString += '\n';             }         }   but when i display this 'responseString ' String using 'apex:outputLabel or apex:outputText or as Exception message '\n' is not converting in new line. Whole String is coming in one line.  Can anyone explain why is this happining
58650
I have a StringProperty(subtype="FILE_PATH) and I am trying to make it so the user selects a folder and then a file is saved out to the location, but the filepath comes out looking really funky.  The folder selected is D:\Pictures, what the StringProperty shows is //..\..\. What is going on here?
13318
How do I split a string with multiple separators in JavaScript? I'm trying to split on both commas and spaces, but AFAIK JavaScript's split() function only supports one separator.
5289
I have a rather big number of source files that I need parse and extract all string literals and put them in a file as play old java constant. For exemple:  Label l = new Label("Cat");   Would become:  Label l = new Label(Constants.CAT);   And in Constants.java I would have:  public final static String CAT = "Cat";   I do not want the strings to be externalized in a property text file. One reason is for consistency and code readability. The other is that our client code uses GWT, which does not support Java property text file mechanism.  I could write some sort of parser (using ant replace task maybe)? But I wondered if an IDE already does this sort of thing automatically.
44622
I have  experience where empty spaces cause unwanted effects. It is not easy to trace the cause of these unwanted effects. In order to eliminate any doubt, I often overuse % as follows.   \usepackage% [% left=3cm, right=3cm% ]% {geometry}   or  \newcommand{\mycommand}% {% This is my command.% }   I got an extreme example that will break what Leo Liu said     In fact, only spaces which would be   output have to be removed by comment.   The following code does not produce output, but we cannot remove the % and leave a blank line between two elements of a list below.  \newpsstyle{gridstyle} { gridwidth=0.4pt, % griddots=0 }   Shortly speaking, where are the necessary places to be appended with % to remove unwanted spaces?
86647
I have noticed that I hardly ever use the \negthinspace command  \!.  This is because I don't know how to use it properly (I do use other spacing commands quite a bit, because I can better understand the guidelines of when they might be useful). When might it be considered appropriate to use this spacing command?
12823
In .NET, what is the difference between String.Empty and "", and are they interchangable, or is there some underlying reference or Localization issues around equality that String.Empty will ensure are not a problem?