1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I delete a letter from a variable

Discussion in 'Web Development & Web Hosting' started by saarrajames, Oct 27, 2017.

  1. saarrajames

    saarrajames New Member

    5
    0
    1
    Hey [​IMG]
    I'm a french people, so please talk me the more simply as you can. [​IMG]
    So... My problem is that a I have a layout in my project "brOKtale" where the player can set his name.
    [​IMG]
    That works except the "Effacer" button. In english, it's "delete", I think.
    He should delete a letter from the variable "HumanName" but I don't know how to do that.
    Exemple : HumanName variable is "Chara", if the player use "Effacer" I want that "Chara" change to "Char".

    I'm waiting for answers. [​IMG]

    Thank you in advance. [​IMG]
     
  2. dmarsh

    dmarsh Terabyte Poster

    3,930
    355
    184
    Hi saarra, sorry that you're french, but don't worry i hear its curable ! My boss is french and probably the best coder I ever met and also a great chap.

    You seem all over the place if I may point out the obvious, trying to run before you can walk. Step back and try and think about the problem.

    Programming is a series of small puzzles, and by testing the computer with the right questions you can get the answers. Its really not about asking people the answers most of the time.

    I advise starting small, like as small as you possibly can, heard of hello world ? Its one statement, try creating programs that are one or two statements. Compile and run them, debug them, refactor them.

    Look at the library documentation for your language, just the core JavaScript language, and see what it says.

    https://www.w3schools.com/jsref/jsref_obj_string.asp
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String

    Think about what a string is and what it does, is it a series of unicode characters in memory? What is a unicode character ? What methods does string support ? How might one of them help you?

    Look at the following methods :
    String.prototype.lastIndexOf()
    String.prototype.endsWith()
    String.prototype.search()
    String.prototype.replace()
    String.prototype.match()
    String.prototype[@@iterator]()

    Try and understand what they all do, write at least one basic program with each.

    Try and find a good core JavaScript course, work through the course and all examples.
    https://www.pluralsight.com/paths/javascript
    https://www.quora.com/What-is-the-best-way-to-learn-JavaScript

    Focus on understanding the core language and library. Then move onto the DOM and browser features, HTML canvas, etc.

    Then come back to phaser once you've done all that.

    Libraries and toolkits are great, but there is a lot to be said from building everything yourself when starting out. Try writing your own string functions from scratch using a loop over the characters, why might your function be worse than the library alternative? etc.
     
    Last edited: Oct 27, 2017
    Dazzo, Jaron78 and JK2447 like this.
  3. Banatawa

    Banatawa New Member

    1
    0
    6
    Hi, I'm the original author of this question ...
    However, I did it on the Scirra website, and I would be very happy to know how my question came about on this site.
     
  4. zxspectrum

    zxspectrum Gigabyte Poster Premium Member

    1,774
    100
    159
    I am very happy to tell you.........(drum roll)......... that someone posted it
     
    Certifications: BSc computing and information systems
    WIP: 70-680
  5. Uaseer

    Uaseer Bit Poster

    11
    0
    2
    Maybe someone has suffered the same thing
     

Share This Page

Loading...