# stringFormat error with %c conversion and constants

**URL:** <https://forum.inductiveautomation.com/t/stringformat-error-with-c-conversion-and-constants/9750>\
**Category:** Ignition\
**Created:** [February 26, 2015, 5:52pm UTC](https://forum.inductiveautomation.com/t/stringformat-error-with-c-conversion-and-constants/9750 "2015-02-26T17:52:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 26, 2015, 5:52pm UTC](https://forum.inductiveautomation.com/t/stringformat-error-with-c-conversion-and-constants/9750/1 "2015-02-26T17:52:30Z")

</div>

New for v7.7.2 (v7.7.2-rc1 worked) custom property ‘abc’ expression:

```auto
stringFormat('%c', 0)
```

yields:

[code]java.lang.Exception: Error executing expression binding on  
ReportPlay.Root Container.abc  
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:82)  
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.startup(ExpressionPropertyAdapter.java:103)  
at com.inductiveautomation.factorypmi.application.binding.DefaultInteractionController.setPropertyAdapter(DefaultInteractionController.java:203)  
at com.inductiveautomation.factorypmi.designer.property.configurators.ExpressionConfigurator.bind(ExpressionConfigurator.java:268)  
at com.inductiveautomation.factorypmi.designer.property.configurators.ExpressionConfigurator.tryCommit(ExpressionConfigurator.java:215)  
at com.inductiveautomation.factorypmi.designer.property.configurators.ConfiguratorMultiplexor$EditorParent.tryCommit(ConfiguratorMultiplexor.java:213)  
at com.inductiveautomation.factorypmi.designer.property.configurators.ConfiguratorMultiplexor.tryCommit(ConfiguratorMultiplexor.java:358)  
at com.inductiveautomation.factorypmi.designer.property.configurators.DynamicOptsDialog.doOK(DynamicOptsDialog.java:117)  
at com.inductiveautomation.factorypmi.designer.property.configurators.DynamicOptsDialog.access$000(DynamicOptsDialog.java:43)  
at com.inductiveautomation.factorypmi.designer.property.configurators.DynamicOptsDialog$1.actionPerformed(DynamicOptsDialog.java:83)  
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)  
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)  
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)  
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)  
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)  
at java.awt.Component.processMouseEvent(Component.java:6525)  
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)  
at java.awt.Component.processEvent(Component.java:6290)  
at java.awt.Container.processEvent(Container.java:2234)  
at java.awt.Component.dispatchEventImpl(Component.java:4881)  
at java.awt.Container.dispatchEventImpl(Container.java:2292)  
at java.awt.Component.dispatchEvent(Component.java:4703)  
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)  
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)  
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)  
at java.awt.Container.dispatchEventImpl(Container.java:2278)  
at java.awt.Window.dispatchEventImpl(Window.java:2739)  
at java.awt.Component.dispatchEvent(Component.java:4703)  
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)  
at java.awt.EventQueue.access$400(EventQueue.java:97)  
at java.awt.EventQueue$3.run(EventQueue.java:697)  
at java.awt.EventQueue$3.run(EventQueue.java:691)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)  
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)  
at java.awt.EventQueue$4.run(EventQueue.java:719)  
at java.awt.EventQueue$4.run(EventQueue.java:717)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)  
at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)  
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)  
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)  
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)  
at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)  
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)  
at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)  
at java.awt.Dialog.show(Dialog.java:1084)  
at java.awt.Component.show(Component.java:1654)  
at java.awt.Component.setVisible(Component.java:1606)  
at java.awt.Window.setVisible(Window.java:1014)  
at java.awt.Dialog.setVisible(Dialog.java:1005)  
at com.inductiveautomation.factorypmi.designer.property.configurators.DynamicOptsDialog.showDialog(DynamicOptsDialog.java:185)  
at com.inductiveautomation.factorypmi.designer.model.VisionDesignerImpl.openBindingDialog(VisionDesignerImpl.java:765)  
at com.inductiveautomation.factorypmi.designer.property.editors.bb.DynamicOptionsButton.actionPerformed(DynamicOptionsButton.java:36)  
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)  
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)  
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)  
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)  
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)  
at com.jidesoft.plaf.basic.BasicJideButtonListener.mouseReleased(Unknown Source)  
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)  
at java.awt.Component.processMouseEvent(Component.java:6525)  
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)  
at java.awt.Component.processEvent(Component.java:6290)  
at java.awt.Container.processEvent(Container.java:2234)  
at java.awt.Component.dispatchEventImpl(Component.java:4881)  
at java.awt.Container.dispatchEventImpl(Container.java:2292)  
at java.awt.Component.dispatchEvent(Component.java:4703)  
at javax.swing.plaf.basic.BasicTableUI$Handler.repostEvent(BasicTableUI.java:948)  
at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(BasicTableUI.java:1164)  
at com.jidesoft.swing.DelegateMouseInputListener.mouseReleased(Unknown Source)  
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)  
at java.awt.Component.processMouseEvent(Component.java:6525)  
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)  
at java.awt.Component.processEvent(Component.java:6290)  
at java.awt.Container.processEvent(Container.java:2234)  
at java.awt.Component.dispatchEventImpl(Component.java:4881)  
at java.awt.Container.dispatchEventImpl(Container.java:2292)  
at java.awt.Component.dispatchEvent(Component.java:4703)  
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)  
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)  
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)  
at java.awt.Container.dispatchEventImpl(Container.java:2278)  
at java.awt.Window.dispatchEventImpl(Window.java:2739)  
at java.awt.Component.dispatchEvent(Component.java:4703)  
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)  
at java.awt.EventQueue.access$400(EventQueue.java:97)  
at java.awt.EventQueue$3.run(EventQueue.java:697)  
at java.awt.EventQueue$3.run(EventQueue.java:691)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)  
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)  
at java.awt.EventQueue$4.run(EventQueue.java:719)  
at java.awt.EventQueue$4.run(EventQueue.java:717)  
at java.security.AccessController.doPrivileged(Native Method)  
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)  
at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)  
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)  
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)  
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)  
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)  
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)  
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)  
Caused by: java.util.IllegalFormatConversionException: c != java.lang.Long  
at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:4302)  
at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869)  
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757)  
at java.util.Formatter.format(Formatter.java:2520)  
at java.util.Formatter.format(Formatter.java:2455)  
at java.lang.String.format(String.java:2927)  
at com.inductiveautomation.ignition.common.expressions.DefaultFunctionFactory$StringFormatFunction.execute(DefaultFunctionFactory.java:1779)  
at com.inductiveautomation.ignition.common.expressions.FunctionExpression.execute(FunctionExpression.java:69)  
at com.inductiveautomation.factorypmi.application.binding.ExpressionPropertyAdapter.runExpression(ExpressionPropertyAdapter.java:73)  
… 104 more

Ignition v7.7.2 (b2014121709)  
Java: Oracle Corporation 1.8.0\_25  
[/code]

If the constant is wrapped in toInt() like so, it works:

```auto
stringFormat('%c', toInt(0))
```

I need a null character to use when removing null padding from certain PLC strings. The expression executor doesn’t recognize numeric escape codes in strings, so this was the easiest way to get a null in a string.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [February 27, 2015, 4:00pm UTC](https://forum.inductiveautomation.com/t/stringformat-error-with-c-conversion-and-constants/9750/2 "2015-02-27T16:00:47Z")

</div>

The toInt() issue was fixed in 7.7.3
