0

How do I add a backspace code to my code that will delete the o from Hello?

For example, Hello would become Hell.

I have tried to use , but it is illegal in XML.

Ryan Gates
  • 4,501
  • 6
  • 50
  • 90
Mario LIPCIK
  • 457
  • 2
  • 9
  • 24
  • I'm sorry, but can you explain how you intend to use all this in more details? What does 'do backspace' mean? – raina77ow Nov 07 '12 at 15:21
  • by backspace I mean buttun on your keyboard, it is button that is used for deleting for example your text. I am filling out my `.docx` template for database, and if any of my variables will be empty it will make empty line, and I want to delete that empty line by XML code or tag – Mario LIPCIK Nov 07 '12 at 15:29
  • 1
    With all due respect (and appreciation for that detailed explanation of that pesky 'Backspace' button mechanic; always missed it), you expect way too much from an XML element. I see that you've mentioned filling '.docx' by PHP; could you show this code instead? – raina77ow Nov 07 '12 at 15:33

2 Answers2

1

Backspace as a control character exists from the days of devices like teletypes, and from paper tape where physical deletion of a character was impossible. As far as I know there are very few applications today that will recognize and interpret the semantics of a backspace in a character stream. That's why it's not supported in XML. If you want to delete a character, simply delete the character.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
0

If you can get it in a string or other sliceable type, there's always slicing; in this case, you'd do something like:

x = 'hello'
'hello'
x[:-1]
'hell'
x[:4]
'hell'
Community
  • 1
  • 1
  • and what if I get empty line in `.docx`, how do I delete empty line from my ziped xml file? ... because I am filling my `.docx` from DB by PHP and if any variable is empty I get blanc line... thats what I want to delete – Mario LIPCIK Nov 07 '12 at 15:34
  • I don't understand what you mean. So you're trying to export to a .docx? Could you show code or something, as I really don't get what you're asking. –  Nov 07 '12 at 16:49