Strange: blank in string. Anybody can explain this?

Hello!
Look at this. Until now I thougt, I had understood ABAP...
Output of the following programm:
1) Strange
2) Strange
3) Strange
4) Strange
5) Strange
6) Strange
Very strange, isn't it?
ABAPDOCU tells, that strings pay attention to blanks.
Can anybody explain this?
REPORT zstrange.
DATA: stringwithspace TYPE string VALUE 'A B',
      teststring TYPE string,
      blankstring TYPE string VALUE ' ',
      l type i.
START-OF-SELECTION.
  IF stringwithspace+1(1) = ' '.
    WRITE: / '1) My guess'.
  ELSE.
    WRITE: / '1) Strange'.
  ENDIF.
  IF stringwithspace+1(1) = blankstring.
    WRITE: / '2) guess'.
  ELSE.
    WRITE: / '2) Strange'.
  ENDIF.
  IF stringwithspace+1(1) = ''.
    WRITE: / '3) guess'.
  ELSE.
    WRITE: / '3) Strange'.
  ENDIF.
  teststring = stringwithspace+1(1).
  IF teststring = ' '.
    WRITE: / '4) Guess'.
  ELSE.
    WRITE: / '4) Strange'.
  ENDIF.
  IF teststring = blankstring.
    WRITE: / '5) Guess'.
  ELSE.
    WRITE: / '5) Strange'.
  ENDIF.
  IF teststring = ''.
    WRITE: / '6) guess'.
  ELSE.
    WRITE: / '6) Strange'.
  ENDIF.

No, thats not strange.
c variables have always a fixed length, it can not contain "nothing". If there are only spaces in, the c variable is treated as empty/initial.
Strings can contain nothing, and they can contain spaces. A string containing blanks is not interpreted as empty/initial.
      blankstring TYPE string VALUE ' ',
What you are doing here is assigning an empty string to the string var blankstring, it does NOT contain a blank.
Constants encapsulated with apostrophes are treated as c variables. But: constants encapsulated within back quotes will be interpreted as string. Change your code to
      blankstring TYPE string VALUE ` `,
Take care of that i used back quotes now, not apostrophes, Now the var blankstring contains a blank and the result in that case will change to MY guess.
Similar the camparison
  IF stringwithspace+1(1) = ' '.
This is comparing a blank with an empty char and thats why you are getting strange.
Change this to
  IF stringwithspace+1(1) = ` `.
and you will get My guess cause now you are comparing a blank with a blank and not a blank with an empty string.
Hope its now clear.

Similar Messages

  • I am new to oracle, plz..anybody can explain this query step by step....plz

    Select distinct(a.esal) from employee1 a where &N = (select count(distinct(b.esal)) from employee1 b where a.esal<=b.esal);
    this is the query to find Nth largest & Nth smallest value from the table employee1....but, i am unable to understand how this query works ....plz..anybody can explain this query step by step with example....plz

    Hi,
    Welcome to the forum!
    The first step in understanding any code is to format it so you can easily see what is a sub-query, what the major clauses of each sub-query are, and things like that.
    For example:
    Select distinct (a.esal)
    from   employee1      a
    where  &N     = (       select  count (distinct (b.esal))
                             from      employee1      b
                    where      a.esal           <= b.esal
                );The only thing I have added to the code you posted was whitespace: newlines, tabs and spaces.
    Now it's easy to see that you're doing a query with a scalar sub-query in the WHERE clause.
    It usually makes sense to read complicated queries from the inside out, that is, start with the deepest nested sub-query.
    In this example, that means:
    select  count (distinct (b.esal))
    from     employee1      b
    where     a.esal           <= b.esalWhat does this query do? Unfortunately, it references something (b.esal) from the super-query, so you can't run it by itself, to see what it does. Let's replace that reference with some hard-coded value, just for now, and run it:
    select  count (distinct (b.esal))
    from     employee1      b
    --where     a.esal           <= b.esal     -- This is the original WHERE clause
    where   a.esal           <= 1000     -- For testing only
    ;Experiment with this for a while, and compare it to the values in the employee1 table (or a small test table that resembles employee1). Try different numbers in place of 1000.
    You'll see that the query is counting how many different salaries are lower than, or equal to, a given salary (1000 in the example above).
    When you understand the sub-query, look at the original query again.
    It is testing to see if exactly &N different esals are lower than or equal to the esal on each row, and displaying that esal if it is. (&N is a substitution variable. If you haven't already defined a value for it, SQL*Plus will ask you for a value when you run the query.)
    In other words, it is finding the N-th lowest value of esal.

  • How do I get rid of the default box on a newly created blank pdf? Anybody not seen this? It gets in the way!

    Asked previously but no replies so far which has surprised me as it must be something others have come across - it's so obvious and 'in your face': Is it possible to delete the blue bordered box which comes as default and centred on the A4 page whenever I create a blank pdf to add fields to - or indeed convert an existing pdf. It won't allow me to delete it, isn't a text box and just gets selected anytime I try to select anything near it!
    Many thanks in advance to anyone who can answer this crazy problem.

    Hi Gilad,
    thankyou! - yes it seems though I was using the text tool when I had this problem: When I had created a few fields in the 'form edit' mode I then may later have added some normal 'comment' fields of text in the normal mode to highlight certain aspects on a form - I used the text tool thinking that was the right way in to add or edit text - I can now see I double click with the hand tool to still be able to access any text field I want to. Yay!
    Many thanks for your kind assistance - I shall try this method later on a new form I was trying to create and which was giving me grief.
    One last thing then: what is that default text field that can't be deleted actually for - why is it there? After all, a 'blank pdf' should surely be a truly blank pdf? Perhaps this is one for mighty Adobe....?
    Kind Regards,
    Pete

  • Question on me51n: who can explain this phenomenon?

    Hi all,
    I am creating a Purchase Requisition via me51n.
    When I fill a 'K' or 'P' in the "acct assignment cat."(A) column in the Header Block. it will automatically bring me to the "Account Assignment" in the Item block, and give the "G/L account no" a default value 400000.
    I dont know why it give me the default value? can someone explain this to me, and where can I set up the configuration for the default value. I tried this in some other system, no such issues.
    Any response will be awarded.
    Thanks and regards,
    Samson

    hi,
    this is because an account modification key is maintained in your account assignemnet.
    please check the same in(OME9)
    say for example if VBR is maintained there check the sane in OBYC where correspondent to that account modification key same GL is maintained which it appears in your PR/PO
    VBR will be there in GBB Transaction key in OBYC
    Edited by: manipal on Dec 28, 2007 9:49 AM

  • Anybody can make this simple custom component a complied clip!!!?

    Hi,
    I have a custom component that has this line of code in the
    first frame:
    trace(this.Num1 + this.Num2);
    where:
    Num1:is a Number parameter created via component definition
    window
    Num2:is a Number parameter created via component definition
    window
    when I convert this component to a compiled clip it dose not
    work because the parameters disappear from the parameter panel and
    the component inspector parameters.
    I have this trace"
    NaN
    anybody can make it work!!!!
    thanks a lot.

    hello, here is another thread with similar issue and the op seems to have it kinda working
    http://forums.adobe.com/thread/1141054
    post 14
    re: the chipmunk audio, i think in the speed rate setting there is a check box to preserve audio pitch (i'm not sure exactly)
    the time remapping feature might work because it does not affect the audio
    here is a creative cow forum thread where the op says it works (perhaps you could post there and get him to give advice)
    http://forums.creativecow.net/thread/3/935431
    the more information you provide the more users can help you
    here is another thread re: gopro3
    http://forums.adobe.com/thread/1116162
    here is a link to converting files if you have a mac
    http://www.brorsoft.com/how-to/import-gopro-hero3-1080-60p-mp4-to-premiere-pro-cs6.html
    here is one from the gopro forum
    http://goprouser.freeforums.org/wvga-120-fps-adobe-premiere-settings-t8315.html

  • HT1222 My iPhone 5 keeps saying I don't have enough storage to update software even though I just purchased 15GB of storage. Can anybody please explain this to me? I'm really not tech savvy AT ALL so I don't have a clue what to do :(

    My iPhone keeps telling me I don't have enough space to update my software. But I just bought 15GB of storage, of which 11.7GB is free! So I don't understand. Can anybody please help me? I'm really bad with technology so I don't have a clue.

    Hi Caroline,
    The storage issue you are having is not related to iCloud. The error is telling you that you do not have enough room on your device itself. You need to go to Settings>General>Usage, and under the Storage section at the top, it lists all of your apps and other things taking up room on your device.
    You will have to delete or reduce the size of items on this list in order to free up some room for your update.
    Also, you may want to try the update by hooking up your device to iTunes on the computer you sync with. It does not require as much free memory to update via iTunes as it does OTA.
    Cheers,
    GB

  • Okay, better explained here. If anybody can solve this you would be amazing, please.

    gopro hero 3 black + premiere pro cs6...
    I shoot at 720p 120fps.
    Premiere doesn't want to read that as 120fps, it wants to read it at 60.
    Video is slow while the audio remains okay but cuts off far too early.
    I can go into modify the clip to make it read as 120fps but then my audio is super fast.
    Tried unlinking audio and video beforehand but it still applies when the clip is dropped to the timeline.
    I used cineform to convert my files but it ends up turning 300mb into 1.5gb...
    I think I may need to figure a h.264 codec within premiere because that is what gopro writes with I think?
    How can I fix this issue this is getting to be obnoxious...

    hello, here is another thread with similar issue and the op seems to have it kinda working
    http://forums.adobe.com/thread/1141054
    post 14
    re: the chipmunk audio, i think in the speed rate setting there is a check box to preserve audio pitch (i'm not sure exactly)
    the time remapping feature might work because it does not affect the audio
    here is a creative cow forum thread where the op says it works (perhaps you could post there and get him to give advice)
    http://forums.creativecow.net/thread/3/935431
    the more information you provide the more users can help you
    here is another thread re: gopro3
    http://forums.adobe.com/thread/1116162
    here is a link to converting files if you have a mac
    http://www.brorsoft.com/how-to/import-gopro-hero3-1080-60p-mp4-to-premiere-pro-cs6.html
    here is one from the gopro forum
    http://goprouser.freeforums.org/wvga-120-fps-adobe-premiere-settings-t8315.html

  • Can anybody can correct this error

    I am learning to devlop a web service using axis and tomcat4.0 . I had done all the settings. I compiled the client application then when tried to run then i get the following error.
    faultcode: {http://xml.apache.org/axis/}server.user exception
    fault string:java.net.socket exception:connection aborted by peers:JCM_recv in socket input stream read
    i cannot write the faultdetails as they are too long. can anybody tell me why i am getting yhis error and how can i correct this error.

    This forum answers questions related to web services developed using Sun's Java Web Services Developer Pack, JWSDP, (http://java.sun.com/webservices). Please post Axis related questions to Axis related forum.
    You can certainly download JWSDP free instead and learn developing a web service using that. It also goes along with a wonderful tutorial which explains the various steps to get you started. I should be able to answer your question then :-)
    Thanks,
    -Arun

  • Help,Could anyone can explain this to me ?

    public class A {
    B b;
         private int a;
         * @param args
         public int get(){
              return this.a;
         public static void main(String[] args) {
    class B{
         private int b;
         A a;
         public int get(){
              return this.b;
    There is a reference to A in Class B,and There is a reference to B
    in Class A,I am confused about this,could someone explain it to me ?

    learnningboy wrote:
    There is a reference to A in Class B,and There is a reference to B
    in Class A,I am confused about this,could someone explain it to me ?For example, there's a road between city X and city Y that goes two ways (you can travel from X to Y and you can also travel from Y to X). That's the idea: both cities hold a reference of each other in them.

  • Who can explain this? No Solution required!

    I had like to see the explanation for the following. Personallyl, I am hoping that the Line Managment 'DLM' will realize that my line is capable of more than 77.43 and raise it to 79+. I hate it when people tell me the maximum you can get on your line is the 96% of the syncing speed e.t.c. If you have any insight on this, I would really appreciate that.
    Thank you.
    If you can't look at the picture below in full resolution then please click here: http://i4.minus.com/i6GJAeU2YW5oP.png
    Here is a real life download speed test whilst using Netherland's proxy servers from London. As you can see that not only the file is being download but Onlive is starting up at the same time. 9.947 MB/sec is equal to 79.576MB download speed. 
    If you can't look at the picture below in full resolution then please click here: 
    http://i4.minus.com/iYq6xXcQLF6F0.png

    john46 wrote:
    "I had like to see the explanation for the following. Personallyl, I am hoping that the Line Managment 'DLM' will realize that my line is capable of more than 77.43 and raise it to 79+. I hate it when people tell me the maximum you can get on your line is the 96% of the syncing speed e.t.c. If you have any insight on this, I would really appreciate that."
    You will never achieve a greater speed than the 77.43 mb IP profile as that is the maximum speed whether you like the answer or not you will never get more than 96% of the sync speed 
    so, does that mean it does not have any effect on what my actual download speed is?
    I just did another speed test and the result was 78.7?
    Your wording doesn't explain how I can download at a faster speed then what I am limited too.

  • If anybody can solve this, they win.

    I have a 15gb third generation (3g) ipod. Bought in April 2003, fully functional until about april 2006, at which point it stopped turning on all together.
    My thought? I made a homemade battery-pack out of an altoids tin, some batteries, and some soldering. It worked really well, providing the right amount of electricity and supplying juice for a good 8 hours---but I thought it may have fried the battery.
    So one day, my ipod stopped working. It wouldn't turn on, nothing. I gave up trying to revive it, and stuffed it away for a few months.
    But then, last week, I plugged it into my computer and it magically worked--not correctly, but it worked. I managed to download the updater and update the firmware--but then the ipod would only display the apple icon followed by the "connect to charge" icon before turning off.
    At the time, I had no idea what was wrong. So I plugged it into the computer, I reset it a thousand times, I went into diagnostic mode, I even opened it up and unplugged and replugged the battery. No dice.
    Later I found out here that a firmware update on a 3g must be completed by plugging the ipod into the AC charger. So I got mine back from my friend and did that, still no dice. Even left it charging for a good day and still nothing. Even bought a replacement battery (mine is getting old and unreliable anyway) and still no dice.
    Here's what I think happened: somewhere between unplugging the battery and resetting a million times, I disrupted the ipod's ability to finish the firmware update. So I'm unable to access anything--including diskmode--because the ipod simply won't run any firmware at all.
    So I'm stuck. Diagnostic mode tells me that everything is a go, but nothing is going anywhere. I'm unable even to get the ipod recognized by a computer in order to format it through windows---at best I can get a bubble to pop up on the computer saying "Device failure"
    If you could offer any help it would be greatly appreciated. Thanks for taking the time
    --David.
    Windows XP Pro
      Windows XP Pro  

    Hi
    First, try this
    For Window computer
    Go to folder “My Computer”
    Hope you can see your iPod there and right click on the iPod
    Choose “Format”. Ensure the settings are at “Default” and that “Quick Format” is not checked
    Now select “Format”
    Eject your iPod and do a Reset
    Open the iPod Updater and click “Restore”
    In case you do not manage to do a “Format” on a window computer, try to use some 3rd party disk utility software, e.g.“HP USB Disk Storage Format Tool”.
    http://discussions.apple.com/thread.jspa?threadID=501330&tstart=0
    If does not work
    Windows users having trouble with their iPods should locate a Mac user. In many cases when an iPod won't show up on a PC that it will show up on the Mac. Then it can be restored. When the PC user returns to his computer the iPod will be recognized by the PC, reformatted for the PC, and usable again. By the way, it works in reverse too. A Mac user often can get his iPod back by connecting it to a PC and restoring it.
    Tips
    a. It does not matter whether the format is completed or not, the key is to erase (or partly) the corrupted firmware files on the Hard Drive of the iPod. After that, when the iPod re-connected with a computer, it will be recognized as an fresh external hard drive, it will show up on the iPod updater.
    b. It is not a difficult issue for a Mac user to find a window base computer, for a PC user, if they can’t find any Mac user, they can go to a nearest Apple Shop for a favor.
    c. You may need to switch around the PC and Mac, try to do several attempts between “Format” and “Restore”
    http://discussions.apple.com/thread.jspa?messageID=2364921&#2364921

  • Anybody can explain composite modes in detail please?

    looking around the web i cannont find any where that explains composite modes in detail!
    any links please to some good web sites that explain a little about each one and how they are used please?
    i understand screen, overlay, multiply etc but i would love to have a reference for each one of them!
    many thanks for any info!

    yep!!! sorry overlooked this again!!
    thanks for the info though!!

  • Anyone can explain this program to me?

    import java.util.List;
    import java.util.LinkedList;
    import java.util.Iterator;
    public class Lab_02
         public static List getLinesOfText(int m)
    {      List lines = new LinkedList();     
              StringBuffer line = new StringBuffer();
              for( int i = 0; i < m; i++ )
    {         for( int j = 0; j < m; j++ )           
                   line.append( j < i ? " ": Integer.toString(i%10) );
         lines.add(line.toString());
                   line.setLength(0);
                   return lines;
         public static void main(String args[])
         int n = 15;
                   if( args.length > 0 )
                   try
         {            n = Integer.parseInt(args[0]);
         catch( NumberFormatException nfe )
         {        String msg = nfe.getMessage();
              System.out.println(msg);
         Iterator lineIterator = getLinesOfText(n).iterator();
         while(lineIterator.hasNext())
              System.out.println(lineIterator.next());

      public static void main(String[] args) {
        int n = 15;
        if( args.length > 0 ) {                     // if an argument was entered
          try { n = Integer.parseInt(args[0]); }    // change it to an int
          catch( NumberFormatException nfe ) {      // if bad format
         String msg = nfe.getMessage();          // print a message
         System.out.println(msg);
    //  call getLinesOfText(with the above number, it returns a List),
    //  get an iterator for that list, and
    //  assign that iterator to lineIterator
          Iterator lineIterator = getLinesOfText(n).iterator();
    //  loop through the iterator printing each value
          while(lineIterator.hasNext()) System.out.println(lineIterator.next());
      public static List getLinesOfText(int m) {   // m = count from call above
        List lines = new LinkedList();             // make a LinkedList, assign to lines
        StringBuffer line = new StringBuffer();    // make a StringBuffer, assign to line
        for( int i = 0; i < m; i++ ) {             // loop m times
          for( int j = 0; j < m; j++ ) {           // for each value of i, loop m times
    // append either a space or the string representation of i modulo 10
    // to the StringBuffer depending on whether j is less that i
    // (modulo = remainder after division by 10)
         line.append( j < i ? " ": Integer.toString(i%10) );
    // Add the string representation of line (a StringBuffer) to the linkedlist lines
          lines.add(line.toString());
    // Clear the StringBuffer
          line.setLength(0);
    // return the linked list
        return lines;
      }

  • Wi-fi diagnostic doen't appear in my MAc with OS 10.8.2. Anybody can explain it? TKS Gabriele

    I need to check my Wi-fi connextion that seems very unstable in the last period.
    I check what software to use and Wi-Fi Diagnostic, the on board utility, semed to be useful but........i did not finf it!! I use the icons on the top of the desktop but it misses the last voice......when i searched on the directory of the /System/Library/CoreServices/Wi-Fi Diagnostics.app but there no app working there.
    Tks for any help.
    Gabriele

    Welcome to the Apple Support Communities
    In the menu bar, press the AirPort icon and open Wi-Fi Diagnostics

  • Can u explain this?

    Hey there!
    I have this bit of code I am trying to understand how the trace references the buttons. If you understand this and can explain this to me I would appreciate it so!
              private function PX(e:Event):void {
                   xd=new XML(e.target.data);
                   xl.removeEventListener(Event.COMPLETE,PX);
                   xl.removeEventListener(IOErrorEvent.IO_ERROR,IE);
                   for each(var sub:XML in xd..subject) { 
                        var a:Array = new Array();
                        for(var i:uint=0;i<sub[0].imgURL.length();i++) {
                             a.push(sub[0].imgURL[i]);
                        imageArray.push(a);
                   subImageArray=imageArray[0];
                   drawButtons();
                   addButtonEffects();
              private function drawButtons():void {
                   var ba:Array = new Array();
                   ba.push(b1,b2,b3,b4,bn,bp)
                   for(var i:uint=0;i<ba.length;i++) {
                        addChild(ba[i]);
                        ba[i].x = i* 25;
                   for(var j:uint=0;j<4;j++) {
                        ba[j].name=j;
                        ba[j].graphics.beginFill(0xFF6666);
                        ba[j].graphics.drawRect(0,0,20,20);
                        ba[j].graphics.endFill();
                        ba[j].buttonMode=true;
                   for(var k:uint=4;k<6;k++) {
                        ba[k].graphics.beginFill(0x00FF00);
                        ba[k].graphics.drawRect(0,0,20,20);
                        ba[k].graphics.endFill();
                        ba[k].buttonMode=true;
              private function addButtonEffects():void {
                   b1.addEventListener(MouseEvent.CLICK,loadImage);
                   b2.addEventListener(MouseEvent.CLICK,loadImage);
                   b3.addEventListener(MouseEvent.CLICK,loadImage);
                   b4.addEventListener(MouseEvent.CLICK,loadImage);
                   bn.addEventListener(MouseEvent.CLICK,nextSubject);
                   bp.addEventListener(MouseEvent.CLICK,previousSubject);
              private function loadImage(e:MouseEvent):void {
                   trace('start ----');
                   trace(subImageArray);
    /////////////////////////////////////THE TRACE BELOW - MAINLY THE PART: subImageArray[Number(e.target.name)] HOW DOES THAT ACCESS THE RIGHT BTNS
                   trace('load image ' + subImageArray[Number(e.target.name)]);
    If you need me to post any of the code above this pls let me know!
    TIA!

    I can not figure out why my code here is not working, because from what you explain it makes sense and it seems that my code would be correct so I must have something else wrong here. Would you mind taking a look at this and possible you can spot what it is that I have wrong?
    I am getting the error:
    TypeError: Error #2007: Perameter url must be non-null.
         at flash.display::Loader/_load()
         at flash.display::Loader/load()
         at asFiles.reality::RealityScenarios/loadImage()[C:(networkpath).as:226]
    here is where line 226 is:
    public function loadImage(e:MouseEvent):void {
         imageHolder = new MovieClip;
         imageLoader = new Loader;
         imageLoader.load(new URLRequest (subImageArray[Number.e.target.name)]));  //THIS IS LINE 226
         imageHolder.addChild(imageLoader);
         imageHolder.x = 75;
         imageHolder.y = 75;
         addChild(imageHolder);
    e.target.name then refers to this:
    public function addButtonEffects():void {
    bp.addEventListener(MouseEvent.CLICK,previousSubject);
    b1.addEventListener(MouseEvent.CLICK,loadImage);  //I CLICKED THIS BUTTON IN PARTICULAR BUT THE SAM ERROR OCCURS FOR  b2, b3, AND b4
    b2.addEventListener(MouseEvent.CLICK,loadImage);
    b3.addEventListener(MouseEvent.CLICK,loadImage);
    b4.addEventListener(MouseEvent.CLICK,loadImage);
    bn.addEventListener(MouseEvent.CLICK,nextSubject);
    that then refers to this code:
    public function drawButtons():void {
         var ba:Array = new Array();
         ba.push(bp,b1,b2,b3,b4,bn)
         for(var i:uint=0;i<ba.length;i++) {
              addChild(ba[i]);
              ba[i].x = 390 + i* 100;
              ba[i].y = 900;
         for(var j:uint=0;j<1;j++) {
              trace(ba[j]);
              btnBack = new BtnBack();
              ba[j].addChild(btnBack)
              ba[j].buttonMode=true;
         for(var k:uint=1; k<5; k++) {
              trace(name + ba[k]);
              ba[k].name = k; //HERE IS NAME
              textfield = new TextField();
              textfield.text = realityArray.shift();
              textfield.setTextFormat(realityformat);
              textfield.autoSize = TextFieldAutoSize.LEFT;
              textfield.selectable = false;
              textfield.antiAliasType = AntiAliasType.ADVANCED;
              textfield.embedFonts = true;
              textfield.scaleX = .2;
              textfield.scaleY = .2;
              ba[k].x = 640;
              ba[k].y = 900;
              ba[k].addChild(textfield);
              ba[k].buttonMode=true;
              addChild(ba[k]);
              TweenLite.to(ba[k], 1, {x:380 + k * 100, y:880, scaleX:4, scaleY:4});
         for(var l:uint=5;l<6;l++) {
              trace(ba[l]);
              btnNext = new BtnNext();
              ba[l].addChild(btnNext);
         addButtonEffects();
    I appreciate the help!

Maybe you are looking for